Catalyst Advent - Day 11 - Caching

Catalyst makes it easy to employ several different types of caching to speed
up your applications.

Cache Plugins

There are three wrapper plugins around common CPAN cache modules:
Cache::FastMmap, Cache::FileCache, and Cache::Memcached. These can be used
to cache the result of slow operations.

This very page you're viewing makes use of the FileCache plugin to cache the
rendered XHTML version of the source POD document. This is an ideal
application for a cache because the source document changes infrequently but
may be viewed many times.

We could actually cache the result forever, but using a value such as 12 hours
allows old entries to be automatically expired when they are no longer needed.

Page Caching

Another method of caching is to cache the entire HTML page. While this is
traditionally handled by a front-end proxy server like Squid, the Catalyst
PageCache plugin makes it trivial to cache the entire output from
frequently-used or slow actions.

Many sites have a busy content-filled front page that might look something
like this. It probably takes a while to process, and will do the exact same
thing for every single user who views the page.

Template Caching

Template Toolkit provides support for caching compiled versions of your
templates. To enable this in Catalyst, use the following configuration.
TT will cache compiled templates keyed on the file mtime, so changes will
still be automatically detected.