Alzabo::Runtime::UniqueRowCache - Implements a row cache for Alzabo
use Alzabo::Runtime::UniqueRowCache; Alzabo::Runtime::UniqueRowCache->clear();
This is a very simple caching mechanism for Alzabo::Runtime::Row objects that tries to ensure that for there is never more than one row object in memory for a given database row.
Alzabo::Runtime::Row
To use it, simply load it.
It can be foiled through the use of Storable or other "deep magic" cloning code, like in the Clone module.
Storable
Clone
The cache is a simple hash kept in memory. If you use this module, you are responsible for clearing the cache as needed. The only time it is cleared automatically is when a table update or delete is performed, in which case all cached rows for that table are cleared.
In a persistent environment like mod_perl, you should clear the cache on a regular basis in order to prevent the cache from getting out of sync with the database. A good way to do this is to clear it at the start of every request.
All methods provided are class methods.
clear
This clears the entire cache
clear_table( $table_object )
Given a table object, this method clear all the rows associated with that table.
row_in_cache( $table_name, $row_id )
Given a table name and a row id, as returned by the Alzabo::Runtime::Row->id_as_string method, this method returns the matching row from the cache, if it exists. Otherwise it returns undef.
Alzabo::Runtime::Row->id_as_string
delete_from_cache( $table_name, $row_id )
Given a table name and a row id, as returned by the Alzabo::Runtime::Row->id_as_string method, this method returns the matching row from the cache.
write_to_cache( $row_object )
Given a row object, this method stores it in the cache.
Dave Rolsky, <autarch@urth.org>
To install Alzabo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alzabo
CPAN shell
perl -MCPAN -e shell install Alzabo
For more information on module installation, please visit the detailed CPAN module installation guide.