Sha256: 126198de5e90e9accee46cd796e08de0fbdb9114a5c29b9aecd826e4efa34602

Contents?: true

Size: 352 Bytes

Versions: 1

Compression:

Stored size: 352 Bytes

Contents

class ActiveRecord::Base
  
  include Cachetastic::Cacheable
  
  def cachetastic_key
    self.id
  end
  
  def self.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
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cachetastic-1.6.0 lib/rails_extensions/cachetastic_active_record_base.rb