Module | Sequel::Plugins::Caching::InstanceMethods |
In: |
lib/sequel/plugins/caching.rb
|
Remove the object from the cache when updating
# File lib/sequel/plugins/caching.rb, line 80 80: def before_update 81: return false if super == false 82: cache_delete 83: end
Return a key unique to the underlying record for caching, based on the primary key value(s) for the object. If the model does not have a primary key, raise an Error.
# File lib/sequel/plugins/caching.rb, line 88 88: def cache_key 89: raise(Error, "No primary key is associated with this model") unless key = primary_key 90: pk = case key 91: when Array 92: key.collect{|k| @values[k]} 93: else 94: @values[key] || (raise Error, 'no primary key for this record') 95: end 96: model.send(:cache_key, pk) 97: end