The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Babble::Cache - Global caching infrastructure for Babble

DESCRIPTION

This module implements a global cache, a hash that is used to store stuff in; and a set of methods to update, query or otherwise manipulate the cache. Including loading and saving it, of course.

METHODS

Babble::Cache provides the following methods:

cache_load($fn)

Loads the file specified, if it exists. The cache database must be valid perl code, and use only one variable: $cachedb, which should be a hashref.

cache_frob($category, $id, $data [, $keys])

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.

cache_update($category, $id, $data, $key)

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.

cache_get($category, $id, $key)

Retrieve the value of the $key element in the $id key in the $category category of the cache.

cache_dump($fn)

Save the cache to the specified file.

AUTHOR

Gergely Nagy, algernon@bonehunter.rulez.org

Bugs should be reported at http://bugs.bonehunter.rulez.org/babble.

SEE ALSO

Babble