You are here

function hook_authcache_backend_key_set in Authenticated User Page Caching (Authcache) 7.2

Make the key available for subsequent request from the same client.

3 functions implement hook_authcache_backend_key_set()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

authcache_backend_test_authcache_backend_key_set in tests/authcache_backend_test.module
Implements hook_authcache_backend_key_set().
authcache_builtin_authcache_backend_key_set in modules/authcache_builtin/authcache_builtin.module
Implements hook_authcache_backend_key_set().
authcache_test_authcache_backend_key_set in tests/authcache_test.module
Implements hook_authcache_backend_key_set().
1 invocation of hook_authcache_backend_key_set()
authcache_exit in ./authcache.module
Implements hook_exit().

File

./authcache.api.php, line 274
Authcache API documentation.

Code

function hook_authcache_backend_key_set($key, $lifetime, $has_session) {
  if ($previous_session && $previous_session !== $current_session) {
    cache_clear_all($previous_session, 'cache_authcache_key');
  }

  // Update cached key if necessary.
  $cache = cache_get($current_session, 'cache_authcache_key');
  if ($cache === FALSE || $cache->expire > 0 && $cache->expire < REQUEST_TIME || $cache->data !== $current_key) {
    $expires = $lifetime ? REQUEST_TIME + $lifetime : CACHE_TEMPORARY;
    cache_set($current_session, $key, 'cache_authcache_key', $expires);
  }
}