Babble::Cache - Caching infrastructure for Babble
This module implements the base Babble::Cache class, one that all other cache modules are based upon. It provides all the methods every module must support. Some of these will only carp - these need to be implemented in subclasses -, some won't have to be touched at all.
Babble::Cache provides the following methods:
Creates a new Babble::Cache object. All parameters passed to it, will be saved for future use. However, the following parameters are recognised by Babble::Cache itself, and are used by the module itself:
The filename of the cache. This is required for proper operation, provided one is using a cache that is loaded from file.
The following methods need to be implemented in subclasses, as they are not generic:
This just carps, as loading is not supported by the base class.
This carps, as saving is not supported by the base class.
This carps, therefore must be implemented by subclasses.
Frobnicate stuff in the cache. This is a quite complex method, which does a few interesting things. First, it looks up if an entry named $id exists under the $category in the cache. If it does, all the keys listed in the $keys arrayref will be copied over from the cache. If the cache does not have the key yet, it will be updated. If the entry is not found in the cache, the keys listed in $keys will be stored in it. If $keys is not defined, all keys of $data will be used.
Update the cache with the values of $data when its $key key is defined. Otherwise, return the contents of the appropriate entry of the cache.
Get or set the cache file name.
Gergely Nagy, algernon@bonehunter.rulez.org
Bugs should be reported at http://bugs.bonehunter.rulez.org/babble.
Babble, Babble::Cache::Class::Hash, Babble::Cache::Dumper, Babble::Cache::Storable
To install Babble, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Babble
CPAN shell
perl -MCPAN -e shell install Babble
For more information on module installation, please visit the detailed CPAN module installation guide.