Action Controller 快取
快取
透過保留計算、呈現與資料庫呼叫的結果以供後續請求使用,是一種加速效能不佳應用程式的簡易方式。
你可以按一下底下的模組,進一步了解每個方法。
注意:若要關閉 Action Controller 提供的所有快取功能,請設定 config.action_controller.perform_caching = false
快取
儲存
從 ActiveSupport::Cache
來的所有快取儲存在可以使用,做為 Action Controller 快取功能的后端。
組態範例(FileStore 是預設值)
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')
已納入模組