[Catalyst] Simple caching question
jester at panix.com
Thu Nov 6 22:23:29 GMT 2008
On Thu, Nov 06, 2008 at 02:02:54PM -0800, J. Shirley wrote:
> 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?
> 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
> 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
Given how light my requirements are--the app's been chugging
along fine for years without any caching--I don't think I need
to bother putting another app into the mix. The memory
requirements for Memcached don't worry me--the server never
goes down, and even if it did, another round of database
retrievals wouldn't hurt anybody--but if it's something that
needs managing, I'll just go with FastMmap and see how that
More information about the Catalyst