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

NAME

Apache::Wyrd::Services::FileCache - Cache service for frequently-accessed files

SYNOPSIS

        use Apache::Wyrd::Services::FileCache;
        $self->get_cached('/var/lib/www/document_template.html');

DESCRIPTION

The FileCache is designed to reduce the number of disk accesses required for Wyrds to make use of frequently-used files. It stores such files in memory, checking every 30 seconds to see if they are changed. As the perl environment persists under mod_perl, the cache persists with it.

For areas where changes are very frequent (such as during development), the caching behavior can be turned off within the apache config by setting NoFileCache to a true value:

        PerlSetVar NoFileCache 1

The time between checks is also confiruable using a PerlSetVar directive:

        PerlSetVar FileCacheTimeout x

Where x is a number of seconds.

FLAGS

allow_nonexistent_files

Do not report a fatal error if the file can't be found. Instead, return undef for contents.

METHODS

(format: (returns) name (arguments after self))

(scalar) get_cached (scalar)

Get the file contents. If the file has never been read by this process, it is read into memory. The argument should be an absolute path to the file.

BUGS/CAVEATS/RESERVED METHODS

reserves the private global variables: $_file_cache_register, $_file_timestamp_register, and $_previous_checktime_register.

AUTHOR

Barry King <wyrd@nospam.wyrdwright.com>

SEE ALSO

Apache::Wyrd

General-purpose HTML-embeddable perl object

LICENSE

Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.