2012-06-28 31 views
1

development.rb緩存配置Rails 3緩存不工作。達利

config.action_controller.perform_caching = true 
    config.cache_store = :dalli_store, 'localhost:11211', 
    { :namespace => APP_NAME, :expires_in => 3.month, :compress => true } 

production.rb緩存配置

config.action_controller.perform_caching = true 
    config.cache_store = :dalli_store, 'localhost:11211', 
    { :namespace => APP_NAME, :expires_in => 3.month, :compress => true } 
控制檯

rails c production 
Loading production environment (Rails 3.2.3) 
1.9.3-p125 :001 > Rails.cache.write 'res', "Hello World" 
=> true 
1.9.3-p125 :002 > Rails.cache.read 'res' 
=> nil 
1.9.3-p125 :003 > 

爲什麼?

+0

運行**的memcached -vv **和複製粘貼在這裏輸出 – Anatoly

+1

這個工作,如果我將3.month替換爲0-30.day 90.day也不起作用 – Ilhom

回答