Genezzo::BufCa::BufCa

A simple in-memory buffer cache for a single process, without locking.
Download

Genezzo::BufCa::BufCa Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jeffrey I Cohen
  • Publisher web site:
  • http://search.cpan.org/~jcohen/Genezzo-0.63/lib/Genezzo/Plan/MakeAlgebra.pm

Genezzo::BufCa::BufCa Tags


Genezzo::BufCa::BufCa Description

A simple in-memory buffer cache for a single process, without locking. Genezzo::BufCa::BufCa is 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;The 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:pinA block is pinned as long as the bceref (returned via GetFree or ReadBlock) is in scope. BufCa uses a scalar tie class to unpin the block when the bceref is garbage collected. The basic pin function acts as a form of advisory locking, and could be upgraded to a true locking mechanism.dirtya block is marked as dirty if it is modified. Requirements: · Perl


Genezzo::BufCa::BufCa Related Software