mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Improving the CakeResponse::cache() method
This commit is contained in:
parent
d117300518
commit
bf22928b6a
2 changed files with 5 additions and 1 deletions
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Add table
Reference in a new issue