Doesn't ctools do this? Something like:
// Put in cache
ctools_include('object-cache');
ctools_object_cache_set('my_module', $id, $object);
// To get from cache:
ctools_include('object-cache');
$object = ctools_object_cache_get('my_module', $id);
// To clear the cache:
ctools_include('object-cache');
ctools_object_cache_clear('my_module', $id);
Comments
Comment #1
rdeboerHi sime,
I don't think you looked at the module code did you? Then you would have seen that indeed there isn't much to the module -- that's the whole point!
But in comparing it to CTools....
First of all Session Cache API supports 4 ways to store session data, not just on the database as CTools does. The idea is to have one transparent 2 function API to read & write to a "cache" whereby the implementation of that cache can be selected (and re-selected) through radio buttons.
As far as your actual storage code via CTools is concerned (2 lines), Session Cache API reduces your code by 50% to one call to a core function (without the need for CTools):
There's a similar one-line equivalent to get form the cache.
Does that make it a little clearer?
Rik