NAME

PAB3::HashMapCache - Cache handler for hashmaps in PAB

SYNOPSIS

use PAB3;
use PAB3::HashMapCache;

$pab = PAB3->new(
    'hashmap_cache' => PAB3::HashMapCache->new(),
);

DESCRIPTION

PAB3::HashMapCache provides an interface to cache hashes that maps to arrays. One time it is added to the PAB class, it will be internally used by it.

METHODS

new ( [%arg] )

Creates a new class of PAB3::HashMapCache and loads the hashmap cache from file if it exists.

posible arguments are:

path_cache     => path to folder where cache can be saved
                  default value is "/tmp"
cache_file     => the name of the cache file
                  default value is the crc32 of calling filename
                  plus '.hashmap.cache'

Example:

$hmc = PAB3::HashMapCache->new(
    'path_cache'     => '/path/to/cache',
    'cache_file'     => 'hashmap.cache',
);
$pab = PAB3->new(
    'hashmap_cache'  =>  $hmc,
);

See also PAB->add_hashmap

load ()

Loads the hashmap cache from file. Is called internally by new() or PAB3->reset.

save ()

Write the hashmap cache to disk.

save() is called internally when the class gets destroyed or inside ModPerl as cleanup callback at the end of each request. If you use PAB3::CGI, it will be registered as callback by PAB3::CGI::cleanup_register. In other environments, like PerlEx or FastCGI, that do not support cleanup mechanism you need to call it by yourself.

AUTHORS

Christian Mueller <christian_at_hbr1.com>

COPYRIGHT

The PAB3::HashMapCache module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.