instance method
cache_page
Ruby on Rails 3.1.12
Since v2.2.3 Last seen in v3.2.22.5Signature
cache_page(content, path, extension = nil)
Manually cache the content in the key determined by path. Example:
cache_page "I'm the cached content", "/lists/show"
Parameters
-
contentreq -
pathreq -
extensionopt = nil
Source
# File actionpack/lib/action_controller/caching/pages.rb, line 73
def cache_page(content, path, extension = nil)
return unless perform_caching
path = page_cache_path(path, extension)
instrument_page_cache :write_page, path do
FileUtils.makedirs(File.dirname(path))
File.open(path, "wb+") { |f| f.write(content) }
end
end
Defined in actionpack/lib/action_controller/caching/pages.rb line 73
· View on GitHub
· Improve this page
· Find usages on GitHub