W3cubDocs

/Ruby on Rails 5.0

module AbstractController::Caching

Included modules:
AbstractController::Caching::ConfigMethods, AbstractController::Caching::Fragments

Public Instance Methods

view_cache_dependencies() Show source
# File actionpack/lib/abstract_controller/caching.rb, line 48
def view_cache_dependencies
  self.class._view_cache_dependencies.map { |dep| instance_exec(&dep) }.compact
end

Protected Instance Methods

cache(key, options = {}) { || ... } Show source

Convenience accessor.

# File actionpack/lib/abstract_controller/caching.rb, line 54
def cache(key, options = {}, &block)
  if cache_configured?
    cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)
  else
    yield
  end
end

© 2004–2017 David Heinemeier Hansson
Licensed under the MIT License.