Hi,
The following is an announcement of Cache::Cache 1.0. Please read the
summary below for more details.
I want to ask a special favor of the modperl community (who tend to
get a lot of mileage out of this code) -- I'm concerned with the use
of Digest::MD5, particularly version 2.16, which is used by the code
to generate unique filenames in the file-based cache. I've been
seeing some pretty ugly bugs with the the MD5 code, and this has been
confirmed on a few mailing lists and CPAN bug reports. Please let me
know if you notice any weird behavior with your system after upgrading
to version 1.0. (All unit test pass consistently, but under certain
conditions, such as when XML::DOM is loaded, I think that Digest::MD5
may always return the same hash, no matter what the key.)
Note that you can simply run Digest::MD5 2.12 and not 2.16 if you have
any issues in production. So don't worry about upgrading to version
1.0 of Cache::Cache.
I'm thinking of switching to Digest::SHA1 in version 1.01 to avoid
this until a new version of Digest::MD5 is released. Does anyone know
of a reason to avoid that? (SHA1 is slightly slower, but very little
time in spent generating keys anyway, so it may not be a big deal.)
For more information on the MD5 issue, please see:
http://rt.cpan.org/NoAuth/Bug.html?id=362.
Thanks to everyone for your help. Cheers,
-DeWitt
Summary:
The Cache modules are designed to assist a developer in persisting
data for a specified period of time. Often these modules are used
in web applications to store data locally to save repeated and
redundant expensive calls to remote machines or databases. People
have also been known to use Cache::Cache for its straightforward
interface in sharing data between runs of an application or
invocations of a CGI-style script or simply as an easy to use
abstraction of the filesystem or shared memory.
Release Notes:
Release of Cache::Cache version 1.0. This version fixes outstanding
issues on Win32 platforms and other minor bug fixes.
Project Homepage:
http://perl-cache.sourceforge.net/
Tar/GZ:
http://prdownloads.sourceforge.net/perl-cache/Cache-Cache-1.0.tar.gz
http://www.cpan.org/authors/id/D/DC/DCLINTON/Cache-Cache-1.0.tar.gz
Changelog:
http://sourceforge.net/project/shownotes.php?release_id=83292
CVS tree (viewcvs):
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/perl-cache/
The following is the Cache-Cache-1.0 README file:
Copyright (C) 2001 DeWitt Clinton All Rights Reserved
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the Perl README file.
NAME
Cache::Cache
DESCRIPTION
The Cache modules are designed to assist a developer in persisting
data for a specified period of time. Often these modules are used
in web applications to store data locally to save repeated and
redundant expensive calls to remote machines or databases. People
have also been known to use Cache::Cache for its straightforward
interface in sharing data between runs of an application or
invocations of a CGI-style script or simply as an easy to use
abstraction of the filesystem or shared memory.
The Cache package provides Cache::Cache, a generic interface
for creating persistent data stores. This interface is implemented
by the Cache::MemoryCache, Cache::SharedMemoryCache, Cache::FileCache,
Cache::SizeAwareFileCache, Cache::SizeAwareMemoryCache, and
Cache::SizeAwareSharedMemoryCache classes.
This work aggregates and extends the obsolete File::Cache and
IPC::Cache projects.
REQUIREMENTS
Digest::MD5
Error
File::Spec
File::Path
IPC::ShareLite
Storable
INSTALLATION
perl Makefile.PL
make
make test
make install
USAGE
First, choose the best type of cache implementation for your needs.
The simplest cache is the MemoryCache, which is suitable for
applications that are serving multiple sequential requests, and
wish to avoid making redundant expensive queries, such as an
Apache/mod_perl application talking to a database. If you wish to
share that data between processes, then perhaps the
SharedMemoryCache is appropriate, although its behavior is tightly
bound to the underlying IPC mechanism, which varies from system to
system, and is unsuitable for large objects or large numbers of
objects. When the SharedMemoryCache is not acceptable, then
FileCache offers all of the same functionality with similar
performance metrics, and it is not limited in terms of the number of
objects or their size. If you wish to maintain a strict limit on
the size of a file system based cache, then the SizeAwareFileCache
is the way to go. Similarly, the SizeAwareMemoryCache and the
SizeAwareSharedMemoryCache add size management functionality
to the MemoryCache and SharedMemoryCache classes respectively.
Using a cache is simple. Here is some sample code for instantiating
and using a file system