page_set_cache
Definition
page_set_cache()
includes/bootstrap.inc, line 261
Description
Store the current page in the cache.
Code
<?php
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());
}
}
}
?> 