Hey,

The latest Tie::Cache is in CPAN, mostly a bugfix release
for the MaxCount config which I broke in .11, changes below.
Also, some benchmark numbers are below from the test.pl script 
run on my Linux PIII 450.

--Josh

NAME
  Tie::Cache - LRU Cache in Memory

SYNOPSIS
     use Tie::Cache;
     tie %cache, 'Tie::Cache', 100, { Debug => 1 };
     tie %cache2, 'Tie::Cache', { MaxCount => 100, MaxBytes => 50000 };
     tie %cache3, 'Tie::Cache', 100, { Debug => 1 , WriteSync => 0};

DESCRIPTION
    This module implements a least recently used (LRU) cache in memory
    through a tie interface. Any time data is stored in the tied hash, that
    key/value pair has an entry time associated with it, and as the cache
    fills up, those members of the cache that are the oldest are removed to
    make room for new entries.

    So, the cache only "remembers" the last written entries, up to the size
    of the cache. This can be especially useful if you access great amounts
    of data, but only access a minority of the data a majority of the time.

++++ Benchmarking operations on Tie::Cache of size 5000

[ timing ] insert of 5000 elements into normal %hash              0.04 CPU
[ timing ] insert of 5000 elements into MaxCount Tie::Cache       0.63 CPU
[ timing ] insert of 5000 elements into MaxBytes Tie::Cache       0.93 CPU
[ timing ] reading 5000 elements from normal %hash                0.01 CPU
[ timing ] reading 5000 elements from MaxCount Tie::Cache         0.34 CPU
[ timing ] reading 5000 elements from MaxBytes Tie::Cache         0.33 CPU
[ timing ] deleting 5000 elements from normal %hash               0.06 CPU
[ timing ] deleting 5000 elements from MaxCount Tie::Cache        0.42 CPU
[ timing ] deleting 5000 elements from MaxBytes Tie::Cache        0.25 CPU

++++ CHANGES

$MODULE = "Tie::Cache"; $VERSION = .15; $DATE = 'TBA';

+ Better test.pl timing output, also differentiate between
  cache with MaxBytes setting and one with just MaxCount,
  as MaxBytes is a bit slower for data size calculations.

+ Better Tie::Cache options / object config error checking,
  die() on obvious misconfigurations that will get developers
  in trouble.

- MaxSize only set if MaxSize or MaxBytes are defined,
  was defaulting to 1 otherwise, killing basic MaxCount config.

+ Optimizations for common use where Tie::Cache is not
  subclassed for write()/read() API

Reply via email to