Module: WCC::Media::Cacheable
- Included in:
- Base
- Defined in:
- lib/wcc/media/cacheable.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.hash_cache_key(hash) ⇒ Object
13 14 15 |
# File 'lib/wcc/media/cacheable.rb', line 13 def self.hash_cache_key(hash) Digest::SHA1.hexdigest(Marshal.dump(hash)) end |
Instance Method Details
#cache_key ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/wcc/media/cacheable.rb', line 4 def cache_key return @cache_key if @cache_key key = (headers&.fetch('Etag', nil) if respond_to?(:headers)) key ||= WCC::Media::Cacheable.hash_cache_key(raw) @cache_key = "#{self.class.name}/#{key}" end |