在environment / development.rb中
config.action_controller.perform_caching = false
在环境/制作中我有
config.action_controller.perform_caching = true
但是,在开发模式下,仍会从缓存中返回一些内容。例如:
translated = Rails.cache.fetch(md5(txt + session[:lang]), {:expires_in => 240.hours}) do
Translation.where("enstr = ? and lang = ?", txt, session[:lang]).limit(1).first
end
有时会返回一个缓存的值,而不是总是命中数据库。我无法确定一个模式,就像它只会发生某些值或一天中的特定时间等等。它显然是随机发生的。我正在使用dalli 2.7.6。