dalli在heroku上没有缓存
我想在heroku上的rails应用程序中启用动作缓存。 在dalli在heroku上没有缓存,heroku,memcached,dalli,Heroku,Memcached,Dalli,我想在heroku上的rails应用程序中启用动作缓存。 在development.rb中I设置: 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
development.rb中
I设置:
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'
中安装了新的gem,并在production.rb
中更改了设置:
config.action_controller.perform_caching = true
config.cache_store = :dalli_store #, ENV['MEMCACHE_SERVERS'], { :namespace => 'myapp', :expires_in => 1.day, :compress => true }
我还尝试启用这两个已注释的参数,但无论如何,我在日志中没有看到读/写片段…
片段,我看到应用程序已通过身份验证,但缓存始终缺失
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运行控制台
我检查缓存是否正在加载:
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"
为什么操作缓存不起作用?您可以尝试改用memcachier吗
- 删除memcahe附加组件
- 添加memcachier附加组件
- 在gem文件中的“dalli”上方添加“memcachier”gem
- 它应该“起作用”
请参见DevCenter中的此处:我更改了do Memcachier,但没有任何更改,但缓存似乎正在以某种方式工作。无论如何,谢谢)