Foo , , -
class Foo < ActiveRecord::Base
def self.find_some_foo(foo_id)
Rails.cache.fetch("foo_#{foo_id}", expires_in: 7.days) do
begin
self.where(:id => foo_id)
rescue Exception => e
logger.info "Exception fetching Foo ID: #{e.to_s}"
nil
end
end
end
end
, config.cache_store= config/application.rb, , config.cache_store = :memory_store , 2.1.
- , , cache_store. . , , , config/application.rb. , , memcache -.
, . , rake tmp:clear. memcache, . .