粘贴至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缓存和片段缓存
有效,页面缓存是会存入磁盘的!!!

本文介绍Rails框架中ActionController缓存配置方法,包括内存缓存、文件缓存等不同类型的缓存存储方式及其设置示例。重点说明了这些配置对Action和Fragment缓存的影响。

被折叠的 条评论
为什么被折叠?



