Module: MongoMapper::Plugins::Caching
- Extended by:
- ActiveSupport::Concern
- Included in:
- Document, EmbeddedDocument
- Defined in:
- lib/mongo_mapper/plugins/caching.rb
Instance Method Summary collapse
Instance Method Details
#cache_key(*suffixes) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mongo_mapper/plugins/caching.rb', line 7 def cache_key(*suffixes) cache_key = case when !persisted? "#{self.class.name}/new" when = self[:updated_at] "#{self.class.name}/#{id}-#{.to_s(:number)}" else "#{self.class.name}/#{id}" end cache_key += "/#{suffixes.join('/')}" unless suffixes.empty? cache_key end |