[Catalyst] Caching problem?

Andy Grundman andy at hybridized.org
Wed Jan 11 17:59:42 CET 2006


Dr. Jennifer Nussbaum wrote:
>  hi,
> 
> I have a Catalyst application that does the usual database thingies. I
> just learned that when database info changes, the pages arent getting
> updated because theyre being cached, so if someone goes to
> www.mysite.com/catalog/view/242, they get the same content even if
> things have changed. Users can "reload" in the browser and get the
> right content.
> 
> Whats the easiest way that this doesnt happen?

You probably want to set a Cache-Control header.  This is a good page to read 
about the topic: http://www.mnot.net/cache_docs/

A simple no-cache setup in Catalyst would look like this, in your end method:

$c->res->headers->header( 'Cache-Control' => 'no-cache, max-age=0' );

-Andy



More information about the Catalyst mailing list