[Catalyst] Simple caching question

J. Shirley jshirley at gmail.com
Thu Nov 6 22:02:54 GMT 2008


On Thu, Nov 6, 2008 at 1:40 PM, Jesse Sheidlower <jester at panix.com> wrote:
>
> I've never used caching before, and am considering adding it
> to one of my apps. Basically, this is a database-backed app
> where the underlying data changes very rarely. There's no
> login. The only dynamic thing that happens is an occasional
> search.
>
> Is my best practice going to be just using C::P::PageCache,
> setting some long expiry time, and setting auto_cache to
> '^(search)', and that's it? (All search results will have a
> "search" in the URL, but nothing else will.) There are no
> other places where I would need to control the cached-ness, or
> the timing, in a more granular way.
>
> If so, which cache plugin do people like, for a FreeBSD
> server?  Memcached?
>
> And if not, what's the way to handle this?
>
> Thanks.
>
> Jesse
>

Catalyst::Plugin::PageCache works very well for what you're dong.
Alternatively, you can also put in a cache outside of your application
like Varnish (I like Varnish more than Squid because you can purge via
regular expression).  PageCache you'll have a harder time of expiring
your cache manually, but you can still do it just fine (I got around
this by simply having an admin controller that would call
clear_cache).

Memcached works well, but it's an extra service to setup, manage and
monitor.  Also, it is is purely in memory.  You could cache to
something that writes to disk, so it will survive restarts.

I'd experiment with a built-in cache like FastMmap (defaults to a 50MB
cache I believe) and if that doesn't work you can start poking at
Memcached.

-J



More information about the Catalyst mailing list