Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cache::file::heap(3pm) [debian man page]

Cache::File::Heap(3pm)					User Contributed Perl Documentation				    Cache::File::Heap(3pm)

NAME
Cache::File::Heap - A file based heap for use by Cache::File SYNOPSIS
use Cache::File::Heap; $heap = Cache::File::Heap->new('/path/to/some/heap/file'); $heap->add($key, $val); ($key, $val) = $heap->minimum; ($key, $val) = $heap->extract_minimum; $heap->delete($key, $val); DESCRIPTION
This module is a wrapper around a Berkeley DB using a btree structure to implement a heap. It is specifically for use by Cache::File for storing expiry times (although with a bit of work it could be made more general). See LIMITATIONS below. CONSTRUCTOR
my $heap = Cache::File::Heap->new( [$dbfile] ); The heap constructor takes an optional argument which is the name of the database file to open. If specified, it will attempt to open the database during construction. A new Cache::File::Heap blessed reference will be returned, or undef if the open failed. METHODS
$h->open($dbfile) Opens the specified database file. $h->close() Closes a previously opened heap database. Note that the database will be automatically closed when the heap reference is destroyed. $h->add($key, $val) Adds a key and value pair to the heap. Currently the key should be a number, whilst the value may be any scalar. Invokes 'die' on failure (use eval to catch it). $h->delete($key, $val) Removes a key and value pair from the heap. Returns 1 if the pair was found and removed, or 0 otherwise. ($key, $val) = $h->minimum() In list context, returns the smallest key and value pair from the heap. In scalar context only the key is returned. Note smallest is defined via a numerical comparison (hence keys should always be numbers). ($key, $vals) = $h->minimum_dup() In list context, returns the smallest key and an array reference containing all the values for that key from the heap. In scalar context only the key is returned. ($key, $val) = $h->extract_minimum() As for $h->minimum(), but the key and value pair is removed from the heap. ($key, $vals) = $h->extract_minimum_dup() As for $h->minimum_dup(), but all the values are removed from the heap. SEE ALSO
Cache::File AUTHOR
Chris Leishman <chris@leishman.org> Based on work by DeWitt Clinton <dewitt@unto.net> COPYRIGHT
Copyright (C) 2003-2006 Chris Leishman. All Rights Reserved. This module is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. This program is free software; you can redistribute or modify it under the same terms as Perl itself. $Id: Heap.pm,v 1.6 2006/01/31 15:23:58 caleishm Exp $ perl v5.12.4 2011-08-05 Cache::File::Heap(3pm)

Check Out this Related Man Page

Cache::Memory(3pm)					User Contributed Perl Documentation					Cache::Memory(3pm)

NAME
Cache::Memory - Memory based implementation of the Cache interface SYNOPSIS
use Cache::Memory; my $cache = Cache::Memory->new( namespace => 'MyNamespace', default_expires => '600 sec' ); See Cache for the usage synopsis. DESCRIPTION
The Cache::Memory class implements the Cache interface. This cache stores data on a per-process basis. This is the fastest of the cache implementations, but is memory intensive and data can not be shared between processes. It also does not persist after the process dies. However data will remain in the cache until cleared or it expires. The data will be shared between instances of the cache object, a cache object going out of scope will not destroy the data. CONSTRUCTOR
my $cache = Cache::Memory->new( %options ) The constructor takes cache properties as named arguments, for example: my $cache = Cache::Memory->new( namespace => 'MyNamespace', default_expires => '600 sec' ); See 'PROPERTIES' below and in the Cache documentation for a list of all available properties that can be set. METHODS
See 'Cache' for the API documentation. PROPERTIES
Cache::Memory adds the property 'namespace', which allows you to specify a different caching store area to use from the default. All methods will work ONLY on the namespace specified. my $ns = $c->namespace(); $c->set_namespace( $namespace ); For additional properties, see the 'Cache' documentation. SEE ALSO
Cache AUTHOR
Chris Leishman <chris@leishman.org> Based on work by DeWitt Clinton <dewitt@unto.net> COPYRIGHT
Copyright (C) 2003-2006 Chris Leishman. All Rights Reserved. This module is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. This program is free software; you can redistribute or modify it under the same terms as Perl itself. $Id: Memory.pm,v 1.9 2006/01/31 15:23:58 caleishm Exp $ perl v5.12.4 2011-08-05 Cache::Memory(3pm)
Man Page