| 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 82
82: def before_update
83: return false if super == false
84: cache_delete
85: 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 90
90: def cache_key
91: raise(Error, "No primary key is associated with this model") unless key = primary_key
92: pk = case key
93: when Array
94: key.collect{|k| @values[k]}
95: else
96: @values[key] || (raise Error, 'no primary key for this record')
97: end
98: model.send(:cache_key, pk)
99: end