You are here

function authcache_builtin_authcache_backend_key_set in Authenticated User Page Caching (Authcache) 7.2

Implements hook_authcache_backend_key_set().

File

modules/authcache_builtin/authcache_builtin.module, line 34
Authcache storage backend for Drupal core cache system.

Code

function authcache_builtin_authcache_backend_key_set($key, $lifetime, $has_session) {
  global $base_root;

  // Clear out old key.
  $previous_session = authcache_backend_initial_session_id();
  if ($previous_session) {
    cache_clear_all($base_root . ':' . $previous_session, 'cache_authcache_key');
  }

  // Update cached key if necessary.
  if ($has_session && authcache_account_allows_caching()) {
    $expires = $lifetime ? REQUEST_TIME + $lifetime : CACHE_TEMPORARY;
    cache_set($base_root . ':' . session_id(), $key, 'cache_authcache_key', $expires);
  }
}