Related

Page caching is an approach to caching where the entire action output of is
stored as a HTML file that the web server can
serve without going through Action Pack. This is the fastest way to cache
your content as opposed to going dynamically through the process of
generating the content. Unfortunately, this incredible speed-up is only
available to stateless pages where all visitors are treated the same.
Content management systems — including weblogs and wikis — have
many pages that are a great fit for this approach, but account-based
systems where people log in and manipulate their own data are often less
likely candidates.

Specifying which actions to cache is done through the caches_page
class method:

This will generate cache files such as weblog/show/5.html and
weblog/new.html, which match the URLs used to trigger the dynamic
generation. This is how the web server is able pick up a cache file when it
exists and otherwise let the request pass on to Action Pack to generate it.

Expiration of the cache is handled by deleting the cached file, which
results in a lazy regeneration approach where the cache is not restored
before another hit is made against it. The API for doing so mimics the
options from url_for and friends:

If you want to expire cached pages from scripts or console just use
class-method expire_page.
But don’t forget about difference between instance and class method. In
class-method you pass page url, not a hash of action/controller: