in reply to how do you label and cache your database queries?
In my systems, I write Perl classes for each of the data objects I'll be manipulating. These classes handle their own caching.
For example, if I'm building a store and I manipulate data for products, I would make a Product class with load() and save() methods. I'd pass an ID to load. The load() method can then check the cache and go to the database if the object I want is not cached. If it does go to the database, it puts the retrieved data in the cache for future use. I would use the object ID and some constant string denoting the object type as my key in the cache.
It would be very easy to build this kind of thing using SPOPS, and some other tools like Alzabo already do it. My homegrown approach used SQL statements coded in the classes themselves rather than trying to auto-generate them.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: how do you label and cache your database queries?
by dthacker (Deacon) on Sep 02, 2001 at 17:07 UTC |