FAQ
Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: 14keymaker.t
Type: application/x-troff
Size: 1165 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080816/9ee5625a/14keymaker.t
-------------- next part --------------
Index: PageCache.pm
===================================================================
@@ -311,13 +313,15 @@

sub _get_page_cache_key {
my $c = shift;
-
+
# We can't rely on the params after the user's code has run, so
# use the key created during the initial dispatch phase
return $c->_page_cache_key if ( $c->_page_cache_key );

- my $key = "/" . $c->req->path;
-
+ # override key if required
+ my $keymaker = $c->config->{page_cache}->{key_maker};
+ my $key = $keymaker ? $keymaker->($c) : "/" . $c->req->path;
+
# prepend language if I18N present.
if ( $c->can('language') ) {
$key = ':' . $c->language . ':' . $key;
@@ -479,6 +483,17 @@
Note that this is called BEFORE auto_check_user, so you have more flexibility
to determine what to do for not logged in users.

+To override the generation of page keys:
+
+__PACKAGE__->config(
+ page_cache => {
+ key_maker => sub {
+ my ($c) = @_;
+ return $c->req->base . '/' . $c->req->path;
+ }
+ }
+);
+
=head1 METHODS

=head2 cache_page

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedAug 16, '08 at 2:28p
activeAug 22, '08 at 7:52a
posts7
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase