Sha256: 14cc1b44aff9102cf47bb28d1bfa9375e77ab5ededb2405fb2609203593d1fb0

Contents?: true

Size: 749 Bytes

Versions: 32

Compression:

Stored size: 749 Bytes

Contents

require 'digest'
module Cloudinary::Cache
  class KeyValueCacheAdapter < CacheAdapter
    def get(public_id, type, resource_type, transformation, format)
      key = generate_cache_key(public_id, type, resource_type, transformation, format)
      @storage.get(key)
    end

    def set(public_id, type, resource_type, transformation, format, value)
      key = generate_cache_key(public_id, type, resource_type, transformation, format)
      @storage.set(key, value)
    end

    def flush_all()
      @storage.flush_all()
    end

    private

    def generate_cache_key(public_id, type, resource_type, transformation, format)
      Digest::SHA1.hexdigest [public_id, type, resource_type, transformation, format].reject(&:blank?)
    end

  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cloudinary-1.16.1 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.16.0 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.15.0 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.14.0 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.13.2 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.13.1 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.13.0 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.12.0 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.11.1 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.11.0 lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.10.1.pre.rc lib/cloudinary/cache/key_value_cache_adapter.rb
cloudinary-1.10.0 lib/cloudinary/cache/key_value_cache_adapter.rb