Module: Sequel::Plugins::Caching::InstanceMethods

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

### Methods

before_update cache_key delete

### Public Instance methods

before_update()

Remove the object from the cache when updating

[Source]

         # File lib/sequel/plugins/caching.rb, line 103
    103:         def before_update
    104:           return false if super == false
    105:           cache_delete
    106:         end

cache_key()

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

delete()

Remove the object from the cache when deleting

[Source]

         # File lib/sequel/plugins/caching.rb, line 123
    123:         def delete
    124:           cache_delete
    125:           super
    126:         end

[Validate]