NAME
Egg::Helper::Plugin::Cache - Helper for Egg::Plugin::Cache.
SYNOPSIS
% perl MyApp/bin/myapp_helper.pl Plugin:Cache [NewCacheName]
DESCRIPTION
It is a plugin to generate the cashe controller who uses it with Egg::Plugin::Cache.
The file named lib/MyApp/Cache/NewCacheName.pm is generated to the project when starting like the example of SYNOPSIS. This module becomes a cash controller.
Cashe driver's default Cache::FileCache
If the name passed to 'include' method is changed, an arbitrary cash module can be used.
__PACKAGE__->include('Cache::Memcached');
Please match the setting passed to 'config' method to the use environment and change. This setting extends to the cash module as it is.
__PACKAGE__->config(
servers => ['127.0.0.1::11211'],
debug => 0,
compress_threshold => 10_000,
);
Additionally, I think it is convenient when the code that relates to cash is added and used.
sub get_member_data {
my $cache= shift;
my $uid = shift || croak q{ I want uid. };
$cache->get($uid) || do {
my $member_data= $e->model->restore_member_data;
$cache->set($uid => $member_data);
$member_data;
};
}
SEE ALSO
Cache::Cache, Egg::Plugin::Cache, Egg::Release,
AUTHOR
Masatoshi Mizuno <lushe@cpan.org>
COPYRIGHT
Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.