You can use the base cache table (cache) or make your own by creating a new table with the same structure.
The cid value doesn't matter -- you make your own (any string). You'll want to make it something that you can easily recreate when it comes time to cache_get the stored data. So your cid could be something like "foo_" . $node->nid or whatever. I usually create a table if I'm going to be caching a lot of entries.
I'm not sure if there is an existing handbook page detailing how/when the cache is cleared based on expire argument you pass in, but the api page for cache_set does have a reasonable overview (
http://api.drupal.org/api/5/function/cache_set)
William
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.
--
http://www.wechange.org/
Because we and the world need to change.
http://www.reuniting.info/
Intimate Relationships, peace and harmony in the couple.