NAME

YAML::LoadFileCached - A wrapper around YAML::LoadFile with caching capabilities.

SYNOPSIS

use YAML::LoadFileCached;
use Data::Dumper;

my $data = LoadFileCached('data.yaml');

print Dumper($data);

DESCRIPTION

This module provides a way to gain speed improvements when you have to repeatedly read a file in YAML format (eg. configuration files) under mod_perl or in a long running process, although at the cost of memory expense.

The by default exported function LoadFileCached caches the results from YAML::LoadFile and simply returns them if called repeatedly.

If the requested file has been changed since the last request, LoadFileCached will reread it.

FUNCTIONS

LoadFileCached (filepath)

see DISCRIPTION.

CacheStatistics ([filepath])

this by default not exported function returns statistics for the cache used by LoadFileCached. If given filepath it returns a Hashref with the keys:

lastchanged

the last modify time in seconds since the epoch (as retourned by stat).

read

number of calls to YAML::LoadFile.

cached

number of cache-served requests.

If called with no argument, CacheStatistics returns a Hash of Hashrefs with filepath as key in the first level.

AUTHOR

Florian Helmberger, <fh@laudatio.com>

SEE ALSO

YAML.

VERSION

$Id: LoadFileCached.pm,v 1.3 2003/02/03 12:10:01 florian Exp $

COPYRIGHT

Copyright (c) 2002 - 2003, Florian Helmberger. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html).