http://dev.catalyst.perl.org/wiki/SolvedIssues
On 30/08/06,
Matthias Zeichmann <[EMAIL PROTECTED]> 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: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
