Some good ideas, I think that this package might come out a bit thin though.
I've written a package that does arbitrary variable caching (like everybody
else). But it has a list of other bells and whistles. Things like cache
expiration and data refresh hooks. It's a pretty simple process.

>From there, I've have (but addmittedly don't use yet) a little DB package that
sits as an interface between the programmer and the DB, and incorporates things
like this caching package at the same time.

So you do:

$dbh = DB->new(...)
$sth = $dbh->prepare($q)
%results1 = $sth->fetch...

$sth = $dbh->prepare($q)
%results2 = $sth->fetch...

# Results are the same, %results2 comes from cache.

$sth = $dbh->prepare($insert)
$sth->execute

$sth = $dbh->prepare($q)
%diff_results = $sth->fetch...
# %diff_results is new data because the DB has changed.


Just some thoughts for y'all to mull over.

----
Rodney Broom


Reply via email to