Module: RedisCacheable::ActiveRecord::ClassMethods

Defined in:
lib/redis_cacheable/active_record.rb

Instance Method Summary collapse

Instance Method Details

#cache_allObject



15
16
17
18
19
20
21
22
23
# File 'lib/redis_cacheable/active_record.rb', line 15

def cache_all
  find_each do |record|
    record.cache_to_redis
  end

  redis do |conn|
    conn.save
  end
end

#find_from_redis(key) ⇒ Object



9
10
11
12
13
# File 'lib/redis_cacheable/active_record.rb', line 9

def find_from_redis(key)
  if data = super(key)
    instantiate(data)
  end
end