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]

Reply via email to