Sha256: 88537fe308e266f59391f735ecea28b137e0a79f7795c16fa89672b6de741cc1
Contents?: true
Size: 829 Bytes
Versions: 5
Compression:
Stored size: 829 Bytes
Contents
class ActiveRecord::Base include Cachetastic::Helpers::ActiveRecord # include helpers at instance level class << self include Cachetastic::Helpers::ActiveRecord # include helpers at class level def get_from_cache(key, self_populate = false) res = cache_class.get(key) if res.nil? && self_populate res = self.name.constantize.find(key) unless res.nil? res.cache_self end end res end def delete_from_cache(key) cache_class.delete(key) end def set_into_cache(key, value, expiry = 0) cache_class.set(key, value, expiry) end end def cache_self cache_class.set(self.id, self) unless self.new_record? end def uncache_self cache_class.delete(self.id) unless self.new_record? end end
Version data entries
5 entries across 5 versions & 1 rubygems