development.rb缓存配置
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 >
为什么?