Module Sequel::Plugins::Caching::InstanceMethods
In: lib/sequel/plugins/caching.rb

Methods

Public Instance methods

Remove the object from the cache when updating

[Source]

     # 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.

[Source]

     # 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

Remove the object from the cache when deleting

[Source]

     # File lib/sequel/plugins/caching.rb, line 134
134:         def delete
135:           cache_delete
136:           super
137:         end

[Validate]