Sha256: 4ad67c9692ed847583c0eaf6fae0fae621cd4e3d8ed423d1ae2c4a0a52f56660
Contents?: true
Size: 589 Bytes
Versions: 13
Compression:
Stored size: 589 Bytes
Contents
module Toy module Caching extend ActiveSupport::Concern module InstanceMethods def cache_key(*suffixes) cache_key = case when new_record? "#{self.class.name}:new" when timestamp = self[:updated_at] "#{self.class.name}:#{id}-#{timestamp.utc.to_s(:number)}" else "#{self.class.name}:#{id}" end cache_key += ":#{suffixes.join(':')}" unless suffixes.empty? cache_key end end end end
Version data entries
13 entries across 13 versions & 1 rubygems