9
我在Rails 2.3.10中使用了Rails.cache.fetch方法:expires_in選項。Expire選項在Rails.cache中不起作用
Rails.cache.fetch 「鑰匙」,:expires_in => 2.seconds
在發展中,我的緩存永遠不會過期和Rails總是命中緩存。
日誌: 「Cache命中」
我在Rails 2.3.10中使用了Rails.cache.fetch方法:expires_in選項。Expire選項在Rails.cache中不起作用
Rails.cache.fetch 「鑰匙」,:expires_in => 2.seconds
在發展中,我的緩存永遠不會過期和Rails總是命中緩存。
日誌: 「Cache命中」
在梁2默認的緩存是ActiveSupport::Cache::MemoryStore
。它不支持:expires_in
選項到期。實際上,只有ActiveSupport::Cache::MemCacheStore
支持緩存過期。
在Rails 3中,所有緩存存儲都支持:expires_in
。