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

NAME

File::Properties::Cache - Perl module providing a cache for use by objects in the File::Properties hierarchy

SYNOPSIS

  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});

ABSTRACT

File::Properties::Cache is a Perl module providing a cache for use by objects in the File::Properties hierarchy.

DESCRIPTION

File::Properties::Cache provides a cache for use by objects in the File::Properties hierarchy. The following methods are provided.

new
  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.

define
  $fpc->define($tablename, $options);

Define a cache table. The optional $options hash may have the following entries:

{'IncludeInsertDate' => 1}

Request an additional column representing row insertion date, together with an associated trigger automatically setting its value.

{'TableVersion' => [$name, $value]}

Specify an attribute name and value to be inserted into the persistent metadata table.

createinsertdatetrigger
  $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.

cinsert
  $fpc->cinsert('CacheTableName', {'Col1' => 1234,'COl2' => 'ABCD'});

Insert a cache table entry.

cretrieve
   my $row = $fpc->cretrieve('CacheTableName', {'Col1' => 1234});

Retrieve a cache table entry.

cproperties
   $fpc->cproperties('CacheTableName', 'PropName', 'PropValue');

Get or set a cache property name/value pair for the specified table.

expirelist
   my $elst = $fpc->expirelist('CacheTableName', 365);

Get a list of cache entries older than a specified number of days.

expire
   $fpc->expire('CacheTableName', 365);

Remove cache entries older than a specified number of days.

cmetadata
   $fpc->cmetadata('AttribName', 'AttribValue');

Get or set cache persistent metadata.

SEE ALSO

File::Properties::Database

AUTHOR

Brendt Wohlberg <wohl@cpan.org>

COPYRIGHT AND LICENSE

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.