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; },
- sector_size
- symlink_size
-
Options for Filesys::DiskUsage. Defaults to the blocksize of the directory holding the repository if Filesys::Statvfs is installed, or just simply 1024 if Filesys::Statvfs is not installed.
Use 1 to get exact numbers for total file size, but this is rarely what you really want (unless you're planning to put it in a tarball).
Returns: The Cache::Repository::Filesys object, or undef if the driver failed to initialise.
- get_meta
-
Overrides Cache::Repository's get_meta function
- set_meta
-
Overrides Cache::Repository's set_meta function
- clear_tag
- add_symlink
- add_files =item add_filehandle
- retrieve_with_callback
- get_size
- list_files
-
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.