class Cloudinary::Cache::RailsCacheAdapter

Public Instance Methods

fetch(public_id, type, resource_type, transformation, format) click to toggle source
# File lib/cloudinary/cache/rails_cache_adapter.rb, line 23
def fetch(public_id, type, resource_type, transformation, format)
  key = generate_cache_key(public_id, type, resource_type, transformation, format)
  Rails.cache.fetch(key, &Proc.new)
end
flush_all() click to toggle source
# File lib/cloudinary/cache/rails_cache_adapter.rb, line 4
def flush_all
end
get(public_id, type, resource_type, transformation, format) click to toggle source
# File lib/cloudinary/cache/rails_cache_adapter.rb, line 7
def get(public_id, type, resource_type, transformation, format)
  key = generate_cache_key(public_id, type, resource_type, transformation, format)
  Rails.cache.read(key)
end
init() click to toggle source
# File lib/cloudinary/cache/rails_cache_adapter.rb, line 12
def init
  unless defined? Rails
    raise CloudinaryException.new "Rails is required in order to use RailsCacheAdapter"
  end
end
set(public_id, type, resource_type, transformation, format, value) click to toggle source
# File lib/cloudinary/cache/rails_cache_adapter.rb, line 18
def set(public_id, type, resource_type, transformation, format, value)
  key = generate_cache_key(public_id, type, resource_type, transformation, format)
  Rails.cache.write(key, value)
end

Private Instance Methods

generate_cache_key(public_id, type, resource_type, transformation, format) click to toggle source
# File lib/cloudinary/cache/rails_cache_adapter.rb, line 29
def generate_cache_key(public_id, type, resource_type, transformation, format)
  Digest::SHA1.hexdigest [public_id, type, resource_type, transformation, format].reject(&:blank?)
end