You are here

function hook_authcache_key_properties in Authenticated User Page Caching (Authcache) 7.2

Return key property values used to calculate the authcache key.

The Authcache Key is only computed during uncached requests and then stored in a record associated with a users session. When attempting to retrieve a page from the cache on subsequent requests, the key is looked up based on the session id on the incoming request. If there is a cached page associated with the given key, it is served right away without any further access checks.

When key properties change during the lifetime of a session, then the Authcache Key associated with a given session id will only be updated on the next page cache miss. Also if there is no existing cache entry for a given URL with the old key, the very next request will immediately lead to a cache miss. It follows that key properties must not depend on factors other than the currently logged in user or in some cases characteristics of the users browser. Otherwise performance of the cache will suffer (i.e., the cache-hit ratio will degrade).

Return value

array An associative array of key-value pairs.

See also

authcache_builtin_cacheinc_retrieve_cache_page

https://www.drupal.org/node/2290611#sub-variation

4 functions implement hook_authcache_key_properties()

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

authcache_ajax_authcache_key_properties in modules/authcache_ajax/authcache_ajax.module
Implements hook_authcache_key_properties().
authcache_authcache_key_properties in ./authcache.module
Implements hook_authcache_key_properties().
authcache_esi_authcache_key_properties in modules/authcache_esi/authcache_esi.module
Implements hook_authcache_key_properties().
authcache_test_authcache_key_properties in tests/authcache_test.module
Implements hook_authcache_key_properties().
1 invocation of hook_authcache_key_properties()
authcache_key_properties in ./authcache.module
Return key-properties.

File

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

Code

function hook_authcache_key_properties() {
  return array(
    'js' => !empty($_COOKIE['has_js']),
  );
}