BBC (British Broadcasting Corporation)


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


        use Cache::AgainstFile;
        my $cache = new Cache::AgainstFile(
                        Method => 'Memory',
                        MaxItems => 16,
                        # ...

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


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.



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.


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.


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


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


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


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


(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