perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Perrin Harkins <per...@elem.com>
Subject Re: Hash Cache using Require
Date Fri, 03 Dec 2004 19:39:46 GMT
On Fri, 2004-12-03 at 11:17 -0800, Bill Whillers wrote:
> Am I more or less efficient than just creating the hashes directly from 
> hitting the database everytime the application needs it? The database is 
> *not* under heavy load, at all.

If the data is small enough, loading it into memory should work fine,
and will be faster than loading from the database.  If you only need
access to specific items at any given time, I'd read those individually
from the database or use a local dbm file (try MLDBM::Sync or
BerkeleyDB) because it will save you memory over loading the full hash
in each process.

> I've considered writing the cache file as a require-able file knowing that it 
> won't be reloaded unless updated; would this be more reasonable or more 
> pointless?

That would work, but you would have to use something like Apache::Reload
to make it refresh when the file changes.  This is not an issue with the
dbm approach.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message