in reply to Using tie to initialize large datastructures
YAY-US! You, too, can be a part of the O-O revolution, my friend! You can be HEE-ULLED of your pro-see-ju-rull ways!
What you're looking for is not something that loads all your data at once. That is waaay too slow to load, as I'm sure you've noticed already. You're looking for something that will cache data.
Now, others have suggested using DBI's caching, and that's good, or some sort of memorize, and that's good, too. I'm suggesting a third method, and that is to write an object that will hide your data-retrieval methods from yourself.
The basic concept is this - you instantiate this object. Then, when you need some data, you ask it for that data, and only that data. It will then check to see if it has it. If it doesn't, then it will go out to the database, get the data, store it within itself, then give it to you. Now, if you ask for that data again (for whatever reason), you will get the data immediately. You don't store the data ... this object does.
This method immediately allows for three things:
Now, you're gonna say "Well, I wrote the object, so I'm storing the data. You're just making my life more complicated."
My answer is simple - "No. You are the script that needs the data, or the general. The object is someone else, a quartermaster if you like. Even though the general puts the quartermaster in his position, he still has to requisition supplies through a known and agreed-upon method."
------
/me wants to be the brightest bulb in the chandelier!
Vote paco for President!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: Why are you even bothering to do it that way?!?
by tilly (Archbishop) on Aug 09, 2001 at 09:22 UTC | |
by dragonchild (Archbishop) on Aug 09, 2001 at 17:19 UTC | |
by tilly (Archbishop) on Aug 09, 2001 at 19:01 UTC |