File::Properties::Cache - Perl module providing a cache for use by objects in the File::Properties hierarchy
use File::Properties::Cache; my $fpc = File::Properties::Cache->new('dbfile.db'); $fpc->define('CacheTableName', ['Col1 INTEGER','Col2 TEXT'], {'IncludeInsertDate' => 1, 'TableVersion' => ['CacheTableVersion', 0.01]}); $fpc->cinsert('CacheTableName', {'Col1' => 1234, 'COl2' => 'ABCD'}); my $row = $fpc->cretrieve('CacheTableName', {'Col1' => 1234});
File::Properties::Cache is a Perl module providing a cache for use by objects in the File::Properties hierarchy.
File::Properties::Cache provides a cache for use by objects in the File::Properties hierarchy. The following methods are provided.
my $db = File::Properties::Cache->new($path, $options);
Constructs a new File::Properties::Cache object. The $path parameter specifies the path to an SQLite DB file and the optional $options hash is passed to the constructor for the File::Properties::Database class from which this class is derived.
$fpc->define($tablename, $options);
Define a cache table. The optional $options hash may have the following entries:
Request an additional column representing row insertion date, together with an associated trigger automatically setting its value.
Specify an attribute name and value to be inserted into the persistent metadata table.
$db->createinsertdatetrigger(CacheTableName', 'ColumnName');
Create a trigger for inserting the current date into the named field of the named table on insertion into that table.
$fpc->cinsert('CacheTableName', {'Col1' => 1234,'COl2' => 'ABCD'});
Insert a cache table entry.
my $row = $fpc->cretrieve('CacheTableName', {'Col1' => 1234});
Retrieve a cache table entry.
$fpc->cproperties('CacheTableName', 'PropName', 'PropValue');
Get or set a cache property name/value pair for the specified table.
my $elst = $fpc->expirelist('CacheTableName', 365);
Get a list of cache entries older than a specified number of days.
$fpc->expire('CacheTableName', 365);
Remove cache entries older than a specified number of days.
$fpc->cmetadata('AttribName', 'AttribValue');
Get or set cache persistent metadata.
File::Properties::Database
Brendt Wohlberg <wohl@cpan.org>
Copyright (C) 2010,2011 by Brendt Wohlberg
This library is available under the terms of the GNU General Public License (GPL), described in the LICENSE file included in this distribution.
To install File::Properties, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Properties
CPAN shell
perl -MCPAN -e shell install File::Properties
For more information on module installation, please visit the detailed CPAN module installation guide.