| 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 103
103: def before_update
104: return false if super == false
105: cache_delete
106: 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 111
111: def cache_key
112: raise(Error, "No primary key is associated with this model") unless key = primary_key
113: pk = case key
114: when Array
115: key.collect{|k| @values[k]}
116: else
117: @values[key] || (raise Error, 'no primary key for this record')
118: end
119: model.send(:cache_key, pk)
120: end