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

Defined in:
lib/sequel/plugins/caching.rb

Instance Method Summary collapse

Instance Method Details

#before_updateObject

Remove the object from the cache when updating



126
127
128
129
# File 'lib/sequel/plugins/caching.rb', line 126

def before_update
  cache_delete
  super
end

#cache_keyObject

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.



134
135
136
# File 'lib/sequel/plugins/caching.rb', line 134

def cache_key
  model.cache_key(pk)
end

#deleteObject

Remove the object from the cache when deleting



139
140
141
142
# File 'lib/sequel/plugins/caching.rb', line 139

def delete
  cache_delete
  super
end