Catalyst::Plugin::Cache::BerkeleyDB
use Catalyst qw/Cache::BerkeleyDB/; MyApp->config->{cache}{storage} = '/tmp/cache'; MyApp->config->{cache}{expires} = 3600; # somewhere in a controller my $data; unless ( $data = $c->cache->get('data') ) { $data = MyApp::Model::Data->retrieve('data'); $c->cache->set( 'data', $data ); } $c->response->body($data);
Adds an accessor for a BerkeleyDB cache in your Catalyst application class.
Returns an instance of Cache::BerkeleyDB.
Options are specified under MyApp->config->{cache}. Besides the options given below, any other options present will be passed along to Cache::BerkeleyDB.
MyApp->config->{cache}
Path to the directory to use for the cache.
In seconds, passed to Cache::BerkeleyDB as default_expires_in. Default is not to expire.
default_expires_in
The namespace to use for the cache. Default is the name of your Catalyst application.
Cache::BerkeleyDB, Catalyst.
David Kamholz <dkamholz@cpan.org>
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
To install Catalyst::Plugin::Cache::BerkeleyDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::Cache::BerkeleyDB
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::Cache::BerkeleyDB
For more information on module installation, please visit the detailed CPAN module installation guide.