Same name and namespace in other branches
- 4.7.x includes/common.inc \page_set_cache()
- 5.x includes/common.inc \page_set_cache()
- 6.x includes/common.inc \page_set_cache()
Store the current page in the cache.
1 call to page_set_cache()
- drupal_page_footer in includes/
common.inc - Perform end-of-request tasks.
File
- includes/
bootstrap.inc, line 261 - Functions that need to be loaded on every Drupal request.
Code
function page_set_cache() {
global $user, $base_url;
if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET') {
// This will fail in some cases, see page_get_cache() for the explanation.
if ($data = ob_get_contents()) {
if (function_exists('gzencode')) {
if (version_compare(phpversion(), '4.2', '>=')) {
$data = gzencode($data, 9, FORCE_GZIP);
}
else {
$data = gzencode($data, FORCE_GZIP);
}
}
ob_end_flush();
cache_set($base_url . request_uri(), $data, CACHE_TEMPORARY, drupal_get_headers());
}
}
}