Dec 9th, 2012
For all cache operations, see /includes/cache.inc
Also see the cache example module. and the Cache API in Drupal 7 docs on drupal.org.
Below is a simple example:
<!--?php if ($cache = cache_get('mymodule_cache_item')) { $data = $cache--->data; } else { $data = 'some data'; $expiration = date(U, strtotime('tomorrow')); cache_set('mymodule_cache_item', $data, 'cache', $expiration); } ?>
It is possible to get multiple cache items at once using <!--?php cache_get_multiple(array &$cids, $bin = 'cache'); ?-->
.
It is possible to delete multiple cache items by using <!--?php cache_clear_all($cid = NULL, $bin = NULL, $wildcard = FALSE); ?-->
, and setting $wildcard=TRUE>