123456789_123456789_123456789_123456789_123456789_

Module: AbstractController::Caching

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: actionpack/lib/abstract_controller/caching.rb,
actionpack/lib/abstract_controller/caching/fragments.rb

Fragments - Attributes & Methods

Class Method Summary

::ActiveSupport::Autoload - Extended

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

Instance Attribute Summary

Instance Method Summary

Fragments - Included

#combined_fragment_cache_key

Given a key (as described in expire_fragment), returns a key array suitable for use in reading, writing, or expiring a cached fragment.

#expire_fragment

Removes fragments from the cache.

#fragment_exist?

Check if a cached fragment from the location signified by key exists (see expire_fragment for acceptable formats).

#read_fragment

Reads a cached fragment from the location signified by key (see expire_fragment for acceptable formats).

#write_fragment

Writes content to the location signified by key (see expire_fragment for acceptable formats).

DSL Calls

included

[ GitHub ]


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'actionpack/lib/abstract_controller/caching.rb', line 30

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?

  config_accessor :enable_fragment_cache_logging
  self.enable_fragment_cache_logging = false

  class_attribute :_view_cache_dependencies, default: []
  helper_method :view_cache_dependencies if respond_to?(:helper_method)
end

Class Attribute Details

.fragment_cache_keys (rw)

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/caching/fragments.rb', line 25

class_attribute :fragment_cache_keys

.fragment_cache_keys?Boolean (rw)

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/caching/fragments.rb', line 25

class_attribute :fragment_cache_keys

Instance Attribute Details

#fragment_cache_keys (rw)

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/caching/fragments.rb', line 25

class_attribute :fragment_cache_keys

#fragment_cache_keys?Boolean (rw)

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/caching/fragments.rb', line 25

class_attribute :fragment_cache_keys

Instance Method Details

#cache(key, options = {}, &block) (private)

Convenience accessor.

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/caching.rb', line 58

def cache(key, options = {}, &block) # :doc:
  if cache_configured?
    cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)
  else
    yield
  end
end

#view_cache_dependencies

[ GitHub ]

  
# File 'actionpack/lib/abstract_controller/caching.rb', line 52

def view_cache_dependencies
  self.class._view_cache_dependencies.filter_map { |dep| instance_exec(&dep) }
end