You are here

protected function APDQCache::cleanSession in Asynchronous Prefetch Database Query Cache 7

Cleans up the per-session cache expiration data.

1 call to APDQCache::cleanSession()
APDQCache::set in ./apdqc.cache.inc
Implements DrupalCacheInterface::set().

File

./apdqc.cache.inc, line 550
Extends Drupal's default database cache so async queries happen.

Class

APDQCache
A pretty darn quick cache implementation of Drupal's default cache backend.

Code

protected function cleanSession() {
  $cache_lifetime = variable_get('cache_lifetime', 0);
  if (isset($_SESSION['cache_expiration'])) {
    $expire = REQUEST_TIME - $cache_lifetime;
    foreach ($_SESSION['cache_expiration'] as $bin => $timestamp) {
      if ($timestamp < $expire) {
        unset($_SESSION['cache_expiration'][$bin]);
      }
    }
    if (!$_SESSION['cache_expiration']) {
      unset($_SESSION['cache_expiration']);
    }
  }
}