NAME

Cache::Repository::Filesys - Filesystem driver for Cache::Repository

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

DESCRIPTION

Caching in a locally-mounted filesystem. Eventually, this will include NFS-level locking, but for now, this module assuming only a single process accessing the repository in write mode at a time.

FUNCTIONS

new

Cache::Repository::Filesys constructor.

my $r = Cache::Repository::Filesys->new(
                                        path => '/some/path/with/enough/space',
                                       );

or

my $r = Cache::Repository->new(
                               style => 'Filesys',
                               path => '/some/path/with/enough/space',
                              );

Parameters:

path

The path in which to store the repository.

clear

If true, clear the repository (if it exists) to start anew. Existing files and meta information will all be removed.

compress

The compress option is ignored in the current version.

dir_mapping

This is a code ref which is given a tag name, and maps it to a relative directory that should contain the tag. The default is to use an MD5 hash of the tag, and use that to create a directory hierarchy for the tag's contents. You can override this to, for example, provide a more-easily-debuggable path such as:

dir_mapping => sub {
    my $tag = shift;
    $tag =~ s:/:_:;
    $tag;
},

Returns: The Cache::Repository::Filesys object, or undef if the driver failed to initialise.

clear_tag
add_files =item add_filehandle
retrieve_with_callback
get_size
list_files
list_tags

See Cache::Repository for documentation on these.

AUTHOR

Darin McBride - dmcbride@cpan.org

COPYRIGHT

Copyright 2005 Darin McBride.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

BUGS

See TODO file.