Take me over?
NAME
Alzabo::ObjectCache::Store::BerkeleyDB - Cache objects in memory
SYNOPSIS
use Alzabo::ObjectCache( store => 'Alzabo::ObjectCache::Store::BerkeleyDB',
sync => 'Alzabo::ObjectCache::Sync::Null',
store_dbm_file => '/tmp/alzabo_storage.db' );
DESCRIPTION
This class simply stores cached objects in a DBM file using the BerkeleyDB
module.
IMPORT PARAMETERS
store_dbm_file => $filename
This parameter is required. It is the name of the file which will be used to store the cached row objects. If the file does not exist, it will be created. If it does exist it will not be overwritten.
clear_on_startup => $boolean
If this is true, then a new file is always created on when the module is loaded, overwriting any existing file. This is generally desirable as an existing file may contain spurious entries from previous executions of the program. However, in the interests of safety, this parameter defaults to false.
METHODS
Note that pretty much all the methods that take an object as an argument will silently do nothing if the object is not already in the cache. The obvious exception is the store_object
method.
new
Returns
A new Alzabo::ObjectCache::Store::BerkeleyDB
object.
fetch_object ($id)
Returns
The specified object if it is in the cache. Otherwise it returns undef.
store_object ($object)
Stores an object in the cache. This will not overwrite an existing object in the cache. To do that you must first call the delete_from_cache
method.
delete_from_cache ($object)
This method allows you to remove an object from the cache. This does not register the object as deleted. It is provided solely so that you can call store_object
after calling this method and have store_object
actually store the new object.
CLASS METHOD
clear
Call this method to completely clear the cache.
AUTHOR
Dave Rolsky, <autarch@urth.org>