[Catalyst] exempt special pages from caching with Catalyst::Plugin::PageCache
Kieren Diment
diment at gmail.com
Thu Aug 31 13:23:40 CEST 2006
Thanks, that's there now:
http://dev.catalyst.perl.org/wiki/SolvedIssues
On 30/08/06, Matthias Zeichmann <matthias at volltext.net> wrote:
>
> hey list,
>
> actually not a question but a how to, kd on #catalyst asked me to post
> (he also suggested to ask for someone with access to put it on the
> SolvedIssues part of the wiki)
>
> what i want to do is cache all pages for an app except of pages ending
> in /debug and /expire
>
> this is accomplished with
>
> MyApp/lib/MyApp.pm
> ---------->8-----------------------------------------------------
> __PACKAGE__->config->{page_cache} > expires => 60,
> auto_cache => [
> '(?!.*/(debug|expire)\z).*',
> ], # cache everything but requests ending in /(debug|expire)
> };
> ---------->8-----------------------------------------------------
>
> while in MyApp/lib/MyApp/Controller/Root.pm i got
> ---------->8-----------------------------------------------------
> sub begin : Private {
> my ( $self, $c ) >
> if ($c->config->{page_cache} && $c->req->path =~ m#(.*)/expire$#) {
> $c->clear_cached_page( '/' . $1 );
> }
> }
> ---------->8-----------------------------------------------------
>
> so actually you can call clear_cached_page from the cached controller in
> contrast to what the manpage says:
> ---------->8-----------------------------------------------------
> clear_cached_page
>
> [...] For obvious
> reasons, this must be called from a different controller than the
> cached controller. You may for example wish to build an admin
> page that lets you clear page caches.
> ---------->8-----------------------------------------------------
>
> kudos for mauke at #perl for help with the negative lookahead :D
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060831/a35b8f18/attachment.htm
More information about the Catalyst
mailing list