You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by DeWitt Clinton <de...@unto.net> on 2001/03/10 19:03:27 UTC

[ANNOUNCE] Cache-Cache-0.03

Summary:

  Perl Cache is the successor to the popular File::Cache and
  IPC::Cache perl libraries. This project unifies those modules under
  the generic Cache::Cache interface and implements Cache::FileCache,
  Cache::MemoryCache, Cache::SharedMemoryCache, and
  Cache::SizeAwareFileCache.


Release Notes:

  This release offers performance enhancements, expiration and size
  reduction bug fixes, an improved expiration string syntax, much
  better documentation, and a new cache API method.


Project Homepage:

  http://sourceforge.net/projects/perl-cache/


Tar/GZ:

  http://ftp1.sourceforge.net/perl-cache/Cache-Cache-0.03.tar.gz


Changelog:

  http://sourceforge.net/project/shownotes.php?release_id=26779


CVS tree (cvsweb):

  http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi?cvsroot=perl-cache



The following is the Cache-Cache-0.03 README file:


Copyright (C) 2001 DeWitt Clinton  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 1, or (at your option)
   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., 675 Mass Ave, Cambridge, MA 02139, USA.


NAME

  Cache::Cache


DESCRIPTION

  The Perl Cache package provides Cache::Cache, a generic interface
  for creating persistent data stores.  This interface is implemented
  by the Cache::FileCache, Cache::SizeAwareFileCache,
  Cache::MemoryCache, and Cache::SharedMemoryCache classes.  This work
  replaces File::Cache and IPC::Cache.


REQUIREMENTS

  Data::Dumper
  Digest::MD5
  File::Spec
  File::Path
  IPC::Shareable


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
  which 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.
 
  Using a cache is simple.  Here is some sample code for instantiating
  and using a MemoryCache:

    use Cache::Cache qw( $EXPIRES_NEVER $EXPIRES_NOW );
    use Cache::MemoryCache;

    my $options_hash_ref = { 'default_expires_in' => '10 seconds' };

    my $cache = new Cache::MemoryCache( $options_hash_ref );

    my $expires_in = '10 minutes';

    $cache->set( 'Key', 'Value', $expires_in );

    # if the next line is called within 10 minutes, then this 
    # will return the cache value

    my $value = $cache->get( 'Key' );

  Please refer to the perldoc for Cache::Cache and the related
  implementations for complete documention.


SEE ALSO

  File::Cache and IPC::Cache


AUTHOR

  Original author: DeWitt Clinton <de...@unto.net>

  Last author:     $Author: dclinton $

  Copyright (C) 2001 DeWitt Clinton













Re: [ANNOUNCE] Cache-Cache-0.03

Posted by DeWitt Clinton <de...@unto.net>.
On Sat, Mar 10, 2001 at 02:00:34PM -0600, Daniel Little (Metrex) wrote:

> Along the same lines, how about making SizeAwareMemoryCache as well
> so that you can specify just how much data you want stored in the
> cache.

Good idea.  I'll add that to the 0.04 feature list as well.

Thanks!

-DeWitt

Re: [ANNOUNCE] Cache-Cache-0.03

Posted by DeWitt Clinton <de...@unto.net>.
On Sat, Mar 10, 2001 at 12:10:35PM -0800, Perrin Harkins wrote:
> "Daniel Little (Metrex)" wrote:
> > Along the same lines, how about making SizeAwareMemoryCache as well so that
> > you can specify just how much data you want stored in the cache.
> 
> Sounds like Joshua Chamas' Tie::Cache module.  It provides a
> size-limited LRU cache.

Note that Cache::SizeAwareFileCache does both a "next expiration" and
a LRU algorithm for limiting the size.  I'll use the same logic for
the SizeAwareMemoryCache.

Thanks,

-DeWitt

RE: [ANNOUNCE] Cache-Cache-0.03

Posted by "Daniel Little (Metrex)" <da...@metrex.net>.
Perrin,

> "Daniel Little (Metrex)" wrote:
> > Along the same lines, how about making SizeAwareMemoryCache as
> well so that
> > you can specify just how much data you want stored in the cache.
>
> Sounds like Joshua Chamas' Tie::Cache module.  It provides a
> size-limited LRU cache.

Indeed! Thanks for the tip! Just installed it and it looks like it fits the
bill perfectly.

Daniel.


Re: [ANNOUNCE] Cache-Cache-0.03

Posted by Perrin Harkins <pe...@primenet.com>.
"Daniel Little (Metrex)" wrote:
> Along the same lines, how about making SizeAwareMemoryCache as well so that
> you can specify just how much data you want stored in the cache.

Sounds like Joshua Chamas' Tie::Cache module.  It provides a
size-limited LRU cache.
- Perrin

RE: [ANNOUNCE] Cache-Cache-0.03

Posted by "Daniel Little (Metrex)" <da...@metrex.net>.
DeWitt,

> > Have you though about making SharedMemoryCache flush to disk if it
> > becomes full but before it's time to expire the data?
>
> I've done a lot of thinking about a multi-layered cache
> implementation.  The API would be the same, but it would be clever
> about using MemoryCache -> SharedMemoryCache -> FileCache to make read
> access to data super efficient, and only persist outward on writes.

Along the same lines, how about making SizeAwareMemoryCache as well so that
you can specify just how much data you want stored in the cache. I haven't
really thought about the implications of this but it seems to me that it
would be a useful extension. Memory's normally tighter than disk space. And
being in a mod_perl server environment where you have large chunks of memory
already used for the web server, it would be good to keep a handle on the
cache growing too large.

I suppose you get a similar effect from just keeping the timeout short but
I'm thinking of a scenario where it's valuable to keep the data for a very
long time, so long as I know that I'm not using all available memory in the
process.

Daniel.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Daniel Little      Metrex Systems Consulting Inc.     danl@metrex.net
210-294 William Ave.                              Tel: (204) 940-4553
Winnipeg, MB.,                                    Cel: (204) 955-0300
Canada, R3B 0R1                                   Fax: (204) 487-6680
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Re: [ANNOUNCE] Cache-Cache-0.03

Posted by DeWitt Clinton <de...@unto.net>.
On Sat, Mar 10, 2001 at 11:17:21AM -0800, Bill Moseley wrote:

> When you say successor to File::Cache does that means File::Cache
> will not be maintained as a separate module anymore?

There are no features in File::Cache that will not exist in
Cache::FileCache and Cache::SizeAwareFileCache.  Actually, as far as I
know, the only old feature missing at all from the new code is the
ability to tell the cache not to physically remove expired objects.
There is a backdoor around this in 0.03, however, so if you need that
functionality, it is already possible.

I'm hoping to retire File::Cache soon unless I get another maintainer.
But it seems silly to have redundant efforts.  The new code is much,
much, better.


> Have you though about making SharedMemoryCache flush to disk if it
> becomes full but before it's time to expire the data?

I've done a lot of thinking about a multi-layered cache
implementation.  The API would be the same, but it would be clever
about using MemoryCache -> SharedMemoryCache -> FileCache to make read
access to data super efficient, and only persist outward on writes.

I'll mark that down as a potential 0.04 feature.  Thanks, Bill!

-DeWitt


Re: [ANNOUNCE] Cache-Cache-0.03

Posted by Bill Moseley <mo...@hank.org>.
At 01:03 PM 03/10/01 -0500, DeWitt Clinton wrote:
>Summary:
>
>  Perl Cache is the successor to the popular File::Cache and
>  IPC::Cache perl libraries. This project unifies those modules under
>  the generic Cache::Cache interface and implements Cache::FileCache,
>  Cache::MemoryCache, Cache::SharedMemoryCache, and
>  Cache::SizeAwareFileCache.

When you say successor to File::Cache does that means File::Cache will not
be maintained as a separate module anymore?

Have you though about making SharedMemoryCache flush to disk if it becomes
full but before it's time to expire the data?



Bill Moseley
mailto:moseley@hank.org