cache_page(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
public
Manually cache the content in the key determined by path.
Example:
cache_page "I'm the cached content", "/lists/show"
# File actionpack/lib/action_controller/caching/pages.rb, line 77
def cache_page(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
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) }
if gzip
Zlib::GzipWriter.open(path + '.gz', gzip) { |f| f.write(content) }
end
end
end