I'll have to keep this in mind.  I don't think it applies here since my
return value is either a 0 or a 1 (no records read or valid data found).  I
fill in the hash reference from the database data.

It never hurts to learn about a new module!

--Chuck

> -----Original Message-----
> From: Frank [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 15, 2002 11:59 AM
> To: '[EMAIL PROTECTED]'
> Subject: Re: Maintaining a Cache of Hash References
> 
> 
> On Tue, Jan 15, 2002 at 11:41:28AM -0600, Tomasi, wrote:
> > I'm trying to maintain a cache of hashes to reduce database 
> hits.  What I
> > want is to determine if I've retrieved the data from the DB 
> before, if so,
> > just pass back the copy of information used last time, 
> otherwise read it
> > from the DB and make a note of it.  It would seem I'm not 
> copying the
> > information in to the $user arg properly.  Something like this:
> > 
> ---end quoted text---
> 
> There is the Memoize module that caches the results of a function....
> 
> sub somefunc {
>       # hit db
>       return $results;
> }
> 
> use Memoize;
> memoize('somefunc');
> 
> IIRC it then seemlessly caches in the background, for DB stuff also
> checkout the expiring caches, in case values change in the DB.
> 
> Documentation here: 
> http://theoryx5.uwinnipeg.ca/CPAN/data/perl/Memoize.html
> 
> -- 
>  Frank Booth - Consultant
> Parasol Solutions Limited.
> (www.parasolsolutions.com)
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to