BBC (British Broadcasting Corporation) > Cache-AgainstFile > Cache::AgainstFile::Memory

Download:
Cache-AgainstFile-1.016.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.015   Source  

NAME ^

Cache::AgainstFile::Memory - cache data parsed from files in memory

SYNOPSIS ^

        use Cache::AgainstFile;
        my $cache = new Cache::AgainstFile(
                \&loader, 
                {
                        Method => 'Memory',
                        MaxItems => 16,
                        # ...
                }
        );

        $data = $cache->get($filename);

DESCRIPTION ^

Data structures parsed from files are cached in memory. This is particularly suited to persistent environments such as modperl or other daemon processes.

For short-lived processes such as CGI scripts, the Storable backend might be more appropriate.

Note that the size() method uses Devel::Size if available, otherwise it returns undef. Devel::Size can consume a reasonable amount of memory working out how much memory you are using! This memory is released after the operation but it will have expanded your process' memory footprint in the process.

OPTIONS ^

Grace

How long to defer statting the file (in seconds). Be careful if you use this in modperl environments as it will result in some children having a new version of the cached item, and some still having the old version.

NoStat

Don't stat files to validate the cache - items are served from the cache until they are purged. Valid values are 0|1 (default=0, i.e. files are statted)

Setting this to 1 is equivalent to setting Grace to an infinite value.

MaxATime

Purge items older than this. Value is in seconds (default=undefined=infinity)

MaxItems

Purge oldest items to reduce cache to this size. Value should be an integer (default=undefined=infinity)

VERSION ^

$Revision: 1.15 $ on $Date: 2005/11/10 15:13:57 $ by $Author: johna $

AUTHOR ^

John Alden & Piers Kent <cpan _at_ bbc _dot_ co _dot_ uk>

COPYRIGHT ^

(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL.

See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt

syntax highlighting: