Improving the CakeResponse::cache() method

This commit is contained in:
José Lorenzo Rodríguez 2010-10-03 19:27:08 -04:30
parent d117300518
commit bf22928b6a
2 changed files with 5 additions and 1 deletions

View file

@ -614,7 +614,8 @@ class CakeResponse {
$time = strtotime($time);
}
$this->header(array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Date' => gmdate("D, j M Y G:i:s ", time()) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", $time) . " GMT",
'Cache-Control' => 'public, max-age=' . ($time - time()),
'Pragma' => 'cache'

View file

@ -230,6 +230,7 @@ class CakeResponseTestCase extends CakeTestCase {
$time = '+1 day';
$expected = array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", strtotime($time)) . " GMT",
'Cache-Control' => 'public, max-age=' . (strtotime($time) - time()),
'Pragma' => 'cache'
@ -242,6 +243,7 @@ class CakeResponseTestCase extends CakeTestCase {
$time = '+5 day';
$expected = array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", strtotime($time)) . " GMT",
'Cache-Control' => 'public, max-age=' . (strtotime($time) - time()),
'Pragma' => 'cache'
@ -254,6 +256,7 @@ class CakeResponseTestCase extends CakeTestCase {
$time = time();
$expected = array(
'Date' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Last-Modified' => gmdate("D, j M Y G:i:s ", $since) . 'GMT',
'Expires' => gmdate("D, j M Y H:i:s", $time) . " GMT",
'Cache-Control' => 'public, max-age=0',
'Pragma' => 'cache'