Module ActionController::Caching::Pages::ClassMethods
In: vendor/rails/actionpack/lib/action_controller/caching.rb

Methods

Public Instance methods

Manually cache the content in the key determined by path. Example:

  cache_page "I'm the cached content", "/lists/show"

[Source]

    # File vendor/rails/actionpack/lib/action_controller/caching.rb, line 83
83:         def cache_page(content, path)
84:           return unless perform_caching
85:           FileUtils.makedirs(File.dirname(page_cache_path(path)))
86:           File.open(page_cache_path(path), "w+") { |f| f.write(content) }
87:           logger.info "Cached page: #{page_cache_file(path)}" unless logger.nil?
88:         end

Caches the actions using the page-caching approach that’ll store the cache in a path within the page_cache_directory that matches the triggering url.

[Source]

    # File vendor/rails/actionpack/lib/action_controller/caching.rb, line 92
92:         def caches_page(*actions)
93:           return unless perform_caching
94:           actions.each do |action| 
95:             class_eval "after_filter { |c| c.cache_page if c.action_name == '#{action}' }"
96:           end
97:         end

Expires the page that was cached with the path as a key. Example:

  expire_page "/lists/show"

[Source]

    # File vendor/rails/actionpack/lib/action_controller/caching.rb, line 75
75:         def expire_page(path)
76:           return unless perform_caching
77:           File.delete(page_cache_path(path)) if File.exists?(page_cache_path(path))
78:           logger.info "Expired page: #{page_cache_file(path)}" unless logger.nil?
79:         end

[Validate]