package Cache::Repository; our $VERSION = '0.06'; use strict; use warnings; use IO::File; use Carp; =head1 NAME Cache::Repository - Generic repository of files =head1 SYNOPSIS my $rep = Cache::Repository->new( style => 'Filesys', # options for the F::R driver ); $rep->add_files(tag => 'groupname', files => \@filenames, basedir => '/tmp', move => 1, ); $rep->add_filehandle(tag => 'anothergroup', filename => 'blah', filehandle => $fh, mode => 0755); $rep->set_meta(tag => 'groupname', meta => { title => 'blah', author => 'foo', }); $rep->retrieve(tag => 'groupname', dest => '/newdir'); my $data = $rep->get_meta(tag => 'groupname'); =head1 DESCRIPTION This module is intended to serve as a repository for files, whether those files are local or remote. Different drivers can work independantly to provide differing backing stores. For example, one driver can use a locally-mounted filesystem (even if that is a network filesystem), another could use FTP or HTTP, another could use gmail, and another could use a relational database such as MySQL or DB2. Drivers may choose to compress the repository, unless explicitly told otherwise. Keeping this in mind, the API presented here cannot expose things that are not generic to other possible implementations. That said, some possible implementations may not allow adding ("sending" to a web server) - it is expected that they will either throw an exception, or take extra params for FTP'ing to the server. =head1 FUNCTIONS =over 4 =item new Cache::Repository constructor. The constructor will load the driver and return an object of the driver package. All other parameters will be passed to the driver for initialisation. my $r = Cache::Repository->new( style => 'Filesys', # ... ); It is up to the underlying driver to determine if the repository created by this is persistant for other processes (e.g., meta-data or even data stored in RAM wouldn't be persistant), or to handle locking issues should multiple processes be accessing the repository simultaneously. Parameters: =over 4 =item style This is the name of the driver. The driver is expected to be Cache::Compress::I