Commit 62f8c490 authored by Jeremy's avatar Jeremy

Issue #1864624 by Jeremy: Add timestamp of creation on pages

parent 9b6bad84
......@@ -207,6 +207,19 @@ For example:
// Cache menus for 10 minutes.
$conf['cache_lifetime_menu'] = 600;
## CACHE HEADER ##
Drupal core indicates whether or not a page was served out of the cache by
setting the 'X-Drupal-Cache' response header with a value of HIT or MISS. If
you'd like to confirm whether pages are actually being retreived from Memcache
and not another backend, you can enable the following option:
$conf['memcache_pagecache_header'] = TRUE;
When enabled, the Memcache module will add its own 'Drupal-PageCache-Memcache'
header. When cached pages are served out of the cache the header will include an
'age=' value indicating how many seconds ago the page was stored in the cache.
## EXAMPLES ##
Example 1:
......
......@@ -197,7 +197,18 @@ class MemCacheDrupal implements DrupalCacheInterface {
}
}
return (bool) $cache;
$valid = (bool) $cache;
if (variable_get('memcache_pagecache_header', FALSE) && ($this->bin == 'cache_page')) {
// Per RFC-6648, don't start with X-
$header = t('Drupal-Pagecache-Memcache: !status', array('!status' => $valid ? t('HIT') : t('MISS')));
if ($valid) {
$header .= t(', age=!age', array('!age' => REQUEST_TIME - $cache->created));
}
header ($header);
}
return $valid;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment