我想在heroku上的rails应用程序中启用操作缓存。在development.rb中,我设置了:
  config.action_controller.perform_caching = true并参见日志中的
Started GET "..." for 127.0.0.1 at 2013-05-17 14:03:25 +0400
...
Write fragment ... 
OR
Read fragment ... (0.2ms)要迁移到生产环境,我通过$heroku addons:add memcache安装了memcache附加组件,在Gemfile:gem 'dalli'中安装了新的->,并更改了production.rb中的设置
config.action_controller.perform_caching = true
config.cache_store = :dalli_store #, ENV['MEMCACHE_SERVERS'], { :namespace => 'myapp', :expires_in => 1.day, :compress => true }我也尝试启用这两个注释参数,但无论如何我在日志中看不到Read/Write fragment ...片段,我看到应用程序通过了身份验证,但缓存总是丢失
Started GET "..." for 195.178.108.38 at 2013-05-17 09:54:19 +0000
Dalli/SASL authenticating as myapp%40heroku.com
Dalli/SASL: Authenticated
cache: [GET ...] miss运行$heroku run console I检查缓存是否正在加载:
irb(main):001:0> Rails.cache.read('color')
Dalli/SASL authenticating as myapp%40heroku.com
Dalli/SASL: Authenticated
=> nil
irb(main):002:0> Rails.cache.write('color', 'red')
=> true
irb(main):003:0> Rails.cache.read('color')
=> "red"为什么操作缓存不起作用?
发布于 2013-05-20 23:36:04
你能试着用memcachier代替吗?
<代码>F29
在DevCenter中查看此处:Memcachier
https://stackoverflow.com/questions/16606789
复制相似问题