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

[Source]

    # 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

Remove the object from the cache when deleting

[Source]

     # File lib/sequel/plugins/caching.rb, line 100
100:         def delete
101:           cache_delete
102:           super
103:         end

[Validate]