I just spent some time answering this question for a client, so I had a quick write-up lying around. I polished it up into an article and published it on the Lullabot site -- http://www.lullabot.com/articles/a_beginners_guide_to_caching_data has an overview of the various bits and pieces I've picked up. The early bits might be a bit unnecessary given that you already know the value of caching ;-) but a tutorial it is! --Jeff Augustin (Beginner) wrote:
Hello,
I cannot find in the handbook a tutorial on the proper way to cache data.
A function (http://drupal.org/node/144969) is calculating the values in a large array, and I want to serialize the result to be able to cache it on the database. This way, the array can be made static between requests, for better performance.
What would be the way to go about it? Which {cache_*} table to use, what value to use for cid, etc? How often or in what conditions are each of the cache tables emptied?
Is any of the above already documented somewhere?
Thanks,
Augustin.