File::Store - a file content caching system
use File::Store; my $contents1 = File::Store::get('/etc/passwd'); my $contents2 = File::Store::get('/etc/passwd');
use File::Store; my $store = new File::Store; my $contents1 = $store->get('/etc/passwd'); my $contents2 = $store->get('/etc/passwd'); $store->clear();
This modules acts as an in-memory cache for files. Each file is read once unless the modification date changes; in which case the file is reread. Files can be automatically flushed based on time, size or number of files.
Files are read from the file system via the function get and cached in memory. Subsequent calls for the same file returns the cached file contents. If the file has been updated on disc, the file is re-read.
If no File::Store object is specified then a global store is used.
The default options are
How long, in seconds, to keep files in the cache. The default is always (0).
The maximum size, in bytes, of files kept in the cache. The default is 0 (infinite).
The maximum number of files kept in the cache. The default is 0 (infinite).
These defaults can be changed globally via the packages variables
my $store = new File::Store (<options>);
Create a new File::Store object with options.
Configure a File::Store.
Return the contents of the specified file from the cache, reading the file from disc if necessary.
$store->clear(); $store->clear($file1, $file2, ...);
Clear the caches inside a File::Store. If files are specified, information about those files are clear. Otherwise the whole cache is cleared.
Remove any items in the cache according to the options expire, size and max. If the cache is too large, then the oldest items (according to their last use) are removed.
Return the number of files in the File::Store.
Return the size, in bytes, of the File::Store.
Return the last modification time of a file contained in the cache. Return 0 if the file isn't cached.
$store->fresh($file1, $file2, ...);
Return whether the list of files are up to date or not. Returns 1 if all files are fresh and undef otherwise.
This is version 1.0 released 2008.
Anthony Fletcher firstname.lastname@example.org
Copyright (c) 1998-2008 Anthony Fletcher. All rights reserved. This module is free software; you can redistribute them and/or modify them under the same terms as Perl itself.
This code is supplied as-is - use at your own risk.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 77:
=back doesn't take any parameters, but you said =back 4
- Around line 431:
You forgot a '=back' before '=head1'