While debugging Redis integration I have found an odd variable page_cache_lifetime in the D6 core, which is not used anywhere else, just in this single line only in the function page_set_cache(), so it is probably a typo which may introduce serious confusion in the caching logic behavior, because it will force CACHE_TEMPORARY (-1), no matter what value is set in the proper cache_lifetime variable.
function page_set_cache() {
global $base_root;
if (drupal_page_is_cacheable()) {
// This will fail in some cases, see page_get_cache() for the explanation.
if ($data = ob_get_contents()) {
ob_end_clean();
$cache_lifetime = variable_get('page_cache_lifetime', 0);
if (variable_get('page_compression', TRUE) && extension_loaded('zlib')) {
$data = gzencode($data, 9, FORCE_GZIP);
}
$cache = (object) array(
'cid' => $base_root . request_uri(),
'data' => $data,
'expire' => $cache_lifetime > 0 ? $cache_lifetime : CACHE_TEMPORARY,
'created' => $_SERVER['REQUEST_TIME'],
'headers' => array(),
);
// Restore preferred header names based on the lower-case names returned
// by drupal_get_header().
$header_names = _drupal_set_preferred_header_name();
foreach (drupal_get_header() as $name_lower => $value) {
$cache->headers[$header_names[$name_lower]] = $value;
}
cache_set($cache->cid, $cache->data, 'cache_page', $cache->expire, serialize($cache->headers));
drupal_page_cache_header($cache);
}
}
}
Comments
Comment #1
longwaveThe code on api.drupal.org looks completely different to this:
https://api.drupal.org/api/drupal/includes!common.inc/function/page_set_...
Are you looking at Pressflow code?
Comment #2
longwavehttps://github.com/pressflow/6/pull/33 looks relevant.
Comment #3
omega8cc commentedAh, right. I should have checked vanilla D6, sorry! It is Pressflow specific. Thanks for the link to the issue on Github. Closing.