Module: Toy::Caching
Instance Method Summary collapse
Instance Method Details
#cache_key(*suffixes) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/toy/caching.rb', line 5 def cache_key(*suffixes) cache_key = case when new_record? "#{self.class.name}:new" when = self[:updated_at] "#{self.class.name}:#{id}-#{.utc.to_s(:number)}" else "#{self.class.name}:#{id}" end cache_key += ":#{suffixes.join(':')}" unless suffixes.empty? cache_key end |