Module ActionController::Caching::Pages::ClassMethods
In: vendor/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/actionpack/lib/action_controller/caching.rb, line 75
75:         def cache_page(content, path)
76:           return unless perform_caching
77:           FileUtils.makedirs(File.dirname(page_cache_path(path)))
78:           File.open(page_cache_path(path), "w+") { |f| f.write(content) }
79:           logger.info "Cached page: #{page_cache_file(path)}" unless logger.nil?
80:         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/actionpack/lib/action_controller/caching.rb, line 84
84:         def caches_page(*actions)
85:           return unless perform_caching
86:           actions.each do |action| 
87:             class_eval "after_filter { |c| c.cache_page if c.action_name == '#{action}' }"
88:           end
89:         end

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

  expire_page "/lists/show"

[Source]

    # File vendor/actionpack/lib/action_controller/caching.rb, line 67
67:         def expire_page(path)
68:           return unless perform_caching
69:           File.delete(page_cache_path(path)) if File.exists?(page_cache_path(path))
70:           logger.info "Expired page: #{page_cache_file(path)}" unless logger.nil?
71:         end

[Validate]