The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Cache::AgainstFile::CacheModule - use Cache or Cache::Cache modules for Cache::AgainstFile

SYNOPSIS

        use Cache::AgainstFile;
        my $cache = new Cache::AgainstFile(
                \&loader, 
                {
                        Method => 'CacheModule',
                        CacheModule => 'Cache::MemoryCache', #This will be loaded on demand
                        CacheModuleOptions => {'default_expires_in' => 300},
                        # ...
                }
        );

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

DESCRIPTION

This backend allows you to apply Cache::AgainstFile to any of the modules on CPAN that conform to the Cache::Cache or Cache interfaces. Data structures are automatically serialised into the cache.

OPTIONS

CacheModule

The module to use for the cache implementation (e.g. Cache::MemoryCache)

CacheModuleOptions

A hashref of options to pass to the cache module's constructor

Grace

How long to defer statting the file (in seconds). This option is only any use with memory caches for two reasons:

First, for filesystem caches, the cost of fetching an item from the cache far exceeds the cost of statting a file.

Second, unlike the file modification time which is stored within the cache itself, the history of when files were last statted is held in memory, so that the cache does not need to be reserialised on each stat. Therefore the stat history is not shared between processes.

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.

VERSION

$Revision: 1.9 $ on $Date: 2005/10/31 21:10:41 $ by $Author: johna $

AUTHOR

John Alden <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