module Cloudinary::Cache
Attributes
Public Class Methods
Source
# File lib/cloudinary/cache.rb, line 9 def get(public_id, options) if block_given? storage.read(generate_cache_key(public_id, options)) {yield} else storage.read(generate_cache_key(public_id, options)) end end
Also aliased as: fetch
Source
# File lib/cloudinary/cache.rb, line 17 def set(public_id, options, value) storage.write(generate_cache_key(public_id, options), value) end
Private Class Methods
Source
# File lib/cloudinary/cache.rb, line 29 def generate_cache_key(public_id, options) type = options[:type] || "upload" resource_type = options[:resource_type] || "image" transformation = Cloudinary::Utils.generate_transformation_string options.clone format = options[:format] Digest::SHA1.hexdigest [public_id, type, resource_type, transformation, format].reject(&:blank?).join('/') end