Tie::Collection - A trivial implementaion of Tie::Cache by using a tied handle of a hash for storage. |
Tie::Collection - A trivial implementaion of Tie::Cache by using a tied handle of a hash for storage.
use Tie::Collection; use DB_File; use Fcntl;
$dbm = tie %hash2, DB_File, 'file.db', O_RDWR | O_CREAT, 0644; tie %hash, Tie::Collection, $dbm, {MaxBytes => $cache_size};
Tie::Collection implements a trivial implementation of Tie::Cache by Joshua Chamas, that gets a tied hash handle to store the data. Assumption was that most common use will be disk storage, therfore the storage hash will probably be tied.
Tie::Collection is useful with DB_File or MLDBM, as will as with Tie::DBI. It was designed to be used with HTML::HTPL in order to cache objects accesses via a key, so they don't have to be read from disk again and again.
Tie::Collection needs two parameters: The handled of the tied hash, and a hashref with parameters to pass to Tie::Cache. (See manpage).
Ariel Brosh, schop@cpan.org. Tie::Cache was written by Joshua Chamas, chamas@alumni.stanford.org
perl(1), the Tie::Cache manpage.
Tie::Collection is part of the HTPL package. See the HTML::HTPL manpage
Tie::Collection - A trivial implementaion of Tie::Cache by using a tied handle of a hash for storage. |