Drupal Gotchya: Cache_get() Returns Expired Items

cache_get() returns $cache objects even if the cached item is stale (expired). The cached data will not be rebuilt every hour in the following example:

* Builds complicated data for the monkey grip.
function custom_monkey_grip_data() {
// Return the cached data
$cache = cache_get('custom:monkey_grip');
  if (!
$cache) {
// Some expensive processing to build the data.
$data = complicated_recursion_and_loops_on_lots_of_data();
// Cache the data and rebuild it every hour
$expire = time() + (60 * 60);
cache_set('custom:monkey_grip', $data, 'cache', $expire);
  else {
$data = $cache->data;

read more


However, the cache entries

However, the cache entries will get cleaned up on cron run by system_cron(), right?