NAME

Petal::Cache::Memory - Caches generated code on disk.

SYNOPSIS

use Petal::Cache::Memory;
my $coderef = Petal::Cache::Memory->get ('foo.html');
unless (defined $coderef)
{
  $coderef = complicated_long_compute_thing();
  Petal::Cache::Memory->set ($coderef);
}

DESCRIPTION

A simple cache module to avoid re-compiling the Perl
code from the Perl data at each request

METHODS

All the methods are static methods.

$class->get ($file);

Returns the cached subroutine if its last modification time is more recent than the last modification time of the template, returns undef otherwise

$class->set ($file, $code);

Sets the cached code for $file.

$class->is_ok ($file);

Returns TRUE if the cache is still fresh, FALSE otherwise.

$class->cached_mtime ($file);

Returns the last modification date of the cached data for $file

$class->current_mtime ($file);

Returns the last modification date for $file

AUTHOR

Jean-Michel Hiver <jhiver@mkdoc.com>

This module is redistributed under the same license as Perl itself.