似乎默认情况下 Catalyst 不输出Cache-Control:
, etc. 标头。我知道我可以像这样在给定的控制器方法中输出它们:
$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}");
不过,在每种方法中这样做都会很痛苦!我更喜欢的是:
- 一组默认标头(现在过期,现在最后修改,缓存控制:无缓存,编译指示:无缓存)
- 一种按方法覆盖默认值的方法。
有没有什么好方法可以做到这一点?