| 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 114
114: def before_update
115: cache_delete
116: super
117: 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 122
122: def cache_key
123: raise(Error, "No primary key is associated with this model") unless key = primary_key
124: pk = case key
125: when Array
126: key.collect{|k| @values[k]}
127: else
128: @values[key] || (raise Error, 'no primary key for this record')
129: end
130: model.send(:cache_key, pk)
131: end