论坛首页 编程语言技术论坛

Rails Caching Stores

浏览 3038 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2012-06-28  

粘贴至Rails API

Caching stores

All the caching stores from ActiveSupport::Cache are available to be used as backends for Action Controller caching. This setting only affects action and fragment caching as page caching is always written to disk.

Configuration examples (MemoryStore is the default):

config.action_controller.cache_store = :memory_store
config.action_controller.cache_store = :file_store, "/path/to/cache/directory"
config.action_controller.cache_store = :mem_cache_store, "localhost"
config.action_controller.cache_store = :mem_cache_store, Memcached::Rails.new("localhost:11211")
config.action_controller.cache_store = MyOwnStore.new("parameter")

 

请注意:设置

config.action_controller.cache_store = :mem_cache_store

 只针对

action and fragment caching #action缓存和片段缓存

 有效,页面缓存是会存入磁盘的!!!

论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics