It seems that by default Catalyst does not output Cache-Control:
, etc. headers. I know I can output them in a given controller method like this:
$c->response->headers->last_modified(time);
$c->response->headers->expires(time + $self->{cache_time});
$c->response->headers->header(cache_control => "public, max-age=$self->{cache_time}");
It'd get pretty painful doing that in each method, though! What I'd prefer is:
Is there a good way to accomplish this?
derobert:
Excellent question. I covered exactly this in an article for the Catalyst advent calendar.
Basically you create a stash variable that defines your cache time for the given action, and then you process it in your Root end routine. See the article for all the details.
JayK