function authcache_varnish_get_key in Authenticated User Page Caching (Authcache) 7.2
Menu callback for varnish cache server.
Return the authcache key as a HTTP header if caching is allowed for the logged in user.
1 string reference to 'authcache_varnish_get_key'
- authcache_varnish_menu in modules/
authcache_varnish/ authcache_varnish.module - Implements hook_menu().
File
- modules/
authcache_varnish/ authcache_varnish.module, line 146 - Authcache cache backend module for varnish.
Code
function authcache_varnish_get_key() {
if (authcache_account_allows_caching()) {
// Set custom X-Authcache-Key header.
drupal_add_http_header('X-Authcache-Key', authcache_key());
}
// Add Vary header.
drupal_add_http_header('Vary', 'X-Authcache-Key-CID');
// Cache response for 3 minutes.
drupal_add_http_header('Cache-Control', 'public, max-age=' . authcache_key_lifetime());
drupal_exit();
}