过期选项在Rails.cache中不起作用

Pie*_*ade 10 memcached ruby-on-rails

我在Rails 2.3.10中使用Rails.cache.fetch方法和:expires_in选项.

Rails.cache.fetch"key",: expires_in => 2.seconds

在开发中,我的缓存永远不会过期,Rails总是会遇到缓存.

日志:"缓存命中"

mol*_*olf 12

Rails 2中的默认缓存是ActiveSupport::Cache::MemoryStore.它不支持:expires_in选项到期.实际上, ActiveSupport::Cache::MemCacheStore支持缓存过期.

在Rails 3中,:expires_in所有缓存存储都支持.