NYCPHP Meetup

NYPHP.org

[nycphp-talk] PEAR DB_Cache question

Adam Maccabee Trachtenberg adam at trachtenberg.com
Tue Dec 2 16:16:23 EST 2003


On Tue, 2 Dec 2003, David Mintz wrote:

> I've been studying the recipe in the Cookbook, which is the closest thing
> to documentation that I've been able to find for DB_Cache, other than in
> the source.

I've often found that PHP Cookbook is the only documention for PEAR
packages. Of course, it means when people ask me questions about the
recipes, I'm forced to re-read to source to rememeber why I wrote what
I did. Even worse, Dave wrote that recipe. :)

> you're telling it where to cache data. Fine. Then you do a query -- call
> it query_1. Suppose in the course of the same script you want to cache the
> results of another query_2. Further suppose that at some point you want to
> be able to flush() the cached results of query_1, but not query_2. If you
> just say flush('db_cache') then you flush the cached results of ~both~
> queries.

Right. I believe the assumption is that you want to flush the cache
when you update your data and that all datasets have similar update windows.

> The more general problem is that my application relies on some MySQL
> tables that get updated many times a day, and some tables that get updated
> a few times a year. Hence my interest in DB_Cache.

Can't you set up two caches? One for the frequently updated data and
one for the few times a year updated data? Or only cache the few times
a year data and don't bother caching the frequently updated data at
all?

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!



More information about the talk mailing list