[Catalyst] (Beginner) Plugins
Jonathan Rockway
jon at jrock.us
Tue Oct 24 16:24:13 GMT 2006
> If the image name had the dimensions I could check if that particular
> image was already generated, but it looks like too much trouble.
That's what this code does:
my $key = join(":", $width, $height, $image );
my $scaled = $cache->get($key);
unless ( defined $scaled ) { ... $scaled = scale_the_image() ... }
If the image was in cache, the unless(){} block is skipped, and the
cached version is stored. If the image wasn't in cache, it's scaled and
then stored in the cache. The $c->cache handles expiration, elimination
of duplicate entries, etc.
Regards,
Jonathan Rockway
--
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
More information about the Catalyst
mailing list