|
NAMEGenezzo::BufCa::BufCa.pm - A simple in-memory buffer cache for a single process, without locking. SYNOPSIS use Genezzo::BufCa::BufCa;
# get a buffer cache
my $bc = Genezzo::BufCa::BufCa->new(blocksize => 10, numblocks => 5);
# find a free block
my $free_arr = $bc->GetFree();
# get the block number and a reference to a Buffer Cache Element
my $blocknum = shift (@{$free_arr});
my $bceref = shift (@{$free_arr});
# obtain the actual Buffer Cache Element
my $bce = $$bceref;
# can later use the block number to revisit this Buffer Cache Element
.
.
.
# get back the same block
$bceref = $bc->ReadBlock(blocknum => $blocknum);
$bce = $$bceref;
DESCRIPTIONThe in-memory buffer cache is a simple module designed to form the basis of a more complicated, file-based, multi-process buffer cache with locking. The buffer cache contains a number of Buffer Cache Elements (BCEs), a special wrapper class for simple byte buffers (blocks). The BCE has two callback functions or closures of note:
FUNCTIONS
EXPORTNone by default. AUTHORJeffrey I. Cohen, jcohen@genezzo.com SEE ALSOperl(1). Copyright (c) 2003, 2004 Jeffrey I Cohen. All rights reserved. This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Address bug reports and comments to: jcohen@genezzo.com For more information, please visit the Genezzo homepage at <http://www.genezzo.com>
|