Sha256: dca14bd3a789a7c064fb333a29cfa623341d447433bcba8221d5786e49c3b958
Contents?: true
Size: 767 Bytes
Versions: 9
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true module WCC module Media module Cacheable 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 def last_modified return @last_modified if @last_modified last_modified = (headers&.fetch('Last-Modified', nil) if respond_to?(:headers)) @last_modified = Time.parse(last_modified) if last_modified && /\S/.match(last_modified) end alias updated_at last_modified def self.hash_cache_key(hash) Digest::SHA1.hexdigest(Marshal.dump(hash)) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems