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