3 package Catalyst::Plugin::Cache::Choose::KeyRegexes;
11 my $ret = $app->maybe::next::method( @_ );
13 my $regexes = $app->config->{cache}{key_regexes} ||= [];
15 die "the regex list must be an array containing regexex/backend pairs" unless ref $regexes eq "ARRAY";
20 sub get_cache_key_regexes {
21 my ( $c, %meta ) = @_;
22 @{ $c->config->{cache}{key_regexes} };
25 sub choose_cache_backend {
26 my ( $c, %meta ) = @_;
28 my @regexes = $c->get_cache_key_regexes( %meta );
30 while ( @regexes and my ( $re, $backend ) = splice( @regexes, 0, 2 ) ) {
31 return $backend if $meta{key} =~ $re;
34 $c->maybe::next::method( %meta );
45 Catalyst::Plugin::Cache::Choose::KeyRegex - Choose a cache backend based on key regexes.
49 use Catalyst::Plugin::Cache::Choose::KeyRegex;