Christian Müller > PAB3-3.201 > PAB3::HashmapCache

Download:
PAB3-3.201.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 2.1.0   Source  

NAME ^

PAB3::HashmapCache - Caches hashmaps used in PAB3

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 PAB3 class, it will be used by it automatically.

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 PAB3->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.

syntax highlighting: