Module: ActionController::Caching
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
Base,
::ActionView::TestCase::TestController,
Rails::ApplicationController,
Rails::InfoController,
Rails::MailersController,
Rails::WelcomeController
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Defined in: | actionpack/lib/action_controller/caching.rb, actionpack/lib/action_controller/caching/fragments.rb |
Overview
Caching is a cheap way of speeding up slow applications by keeping the result of calculations, renderings, and database calls around for subsequent requests.
You can read more about each approach by clicking the modules below.
Note: To turn off all caching, set
config.action_controller.perform_caching = false
Caching stores
All the caching stores from ::ActiveSupport::Cache are available to be used as backends for Action Controller caching.
Configuration examples (FileStore 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')
Constant Summary
::ActiveSupport::Callbacks - Included
Class Method Summary
::ActiveSupport::DescendantsTracker - self
clear, descendants, direct_descendants, | |
store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. |
::ActiveSupport::Autoload - Extended
::ActiveSupport::Concern - Extended
Instance Attribute Summary
ConfigMethods - Included
RackDelegation - Included
Instance Method Summary
Fragments - Included
#expire_fragment | Removes fragments from the cache. |
#fragment_cache_key | Given a key (as described in |
#fragment_exist? | Check if a cached fragment from the location signified by |
#read_fragment | Reads a cached fragment from the location signified by |
#write_fragment | Writes |
::AbstractController::Callbacks - Included
#process_action | Override AbstractController::Base's process_action to run the process_action callbacks around the normal behavior. |
::ActiveSupport::Callbacks - Included
#run_callbacks | Runs the callbacks for the given event. |
RackDelegation - Included
DSL Calls
included
[ GitHub ]55 56 57 58 59 60 61 62 63 64 65 66 67
# File 'actionpack/lib/action_controller/caching.rb', line 55
included do extend ConfigMethods config_accessor :default_static_extension self.default_static_extension ||= '.html' config_accessor :perform_caching self.perform_caching = true if perform_caching.nil? class_attribute :_view_cache_dependencies self._view_cache_dependencies = [] helper_method :view_cache_dependencies if respond_to?(:helper_method) end
Instance Method Details
#view_cache_dependencies
[ GitHub ]# File 'actionpack/lib/action_controller/caching.rb', line 75
def view_cache_dependencies self.class._view_cache_dependencies.map { |dep| instance_exec(&dep) }.compact end