module Sequel::Plugins::ActsAsCacheable::InstanceMethods
Public Instance Methods
cache!()
click to toggle source
# File lib/sequel_acts_as_cacheable.rb, line 80 def cache! unless new? marshallable! if respond_to? :before_cache before_cache end acts_as_cacheable_cache.set model_cache_key, self, acts_as_cacheable_time_to_live end end
cached?()
click to toggle source
# File lib/sequel_acts_as_cacheable.rb, line 96 def cached? acts_as_cacheable_cache.get(model_cache_key).present? end
delete()
click to toggle source
Calls superclass method
# File lib/sequel_acts_as_cacheable.rb, line 106 def delete begin result = super rescue Sequel::NoExistingObject if acts_as_cacheable_logger acts_as_cacheable_logger.error "attempted to delete a record that doesn't exist" end end invalidate_cache! result end
destroy(opts = {})
click to toggle source
Calls superclass method
# File lib/sequel_acts_as_cacheable.rb, line 118 def destroy opts = {} result = super opts invalidate_cache! unless false == result result end
save(*columns)
click to toggle source
Calls superclass method
# File lib/sequel_acts_as_cacheable.rb, line 100 def save *columns result = super *columns invalidate_cache! if result && !new? result end
uncache!()
click to toggle source
# File lib/sequel_acts_as_cacheable.rb, line 90 def uncache! acts_as_cacheable_cache.delete self.class.model_cache_key id end
Also aliased as: invalidate_cache!
Private Instance Methods
acts_as_cacheable_cache()
click to toggle source
# File lib/sequel_acts_as_cacheable.rb, line 129 def acts_as_cacheable_cache model.acts_as_cacheable_cache end
acts_as_cacheable_time_to_live()
click to toggle source
# File lib/sequel_acts_as_cacheable.rb, line 133 def acts_as_cacheable_time_to_live model.acts_as_cacheable_time_to_live end
model_cache_key()
click to toggle source
# File lib/sequel_acts_as_cacheable.rb, line 125 def model_cache_key model.model_cache_key id end