Cache::Repository::Filesys - Filesystem driver for Cache::Repository
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');
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.
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:
The path in which to store the repository.
If true, clear the repository (if it exists) to start anew. Existing files and meta information will all be removed.
The compress option is ignored in the current version.
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; },
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.
Overrides Cache::Repository's get_meta function
Overrides Cache::Repository's set_meta function
See Cache::Repository for documentation on these.
Darin McBride - dmcbride@cpan.org
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.
See TODO file.
To install Cache::Repository, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cache::Repository
CPAN shell
perl -MCPAN -e shell install Cache::Repository
For more information on module installation, please visit the detailed CPAN module installation guide.