|
|
|
@ -151,21 +151,19 @@ class Response {
|
|
|
|
|
* @return object Self reference
|
|
|
|
|
*/
|
|
|
|
|
public function cache($expires) {
|
|
|
|
|
if ($expires !== true) {
|
|
|
|
|
if ($expires === false) {
|
|
|
|
|
$this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
|
|
|
|
|
$this->headers['Cache-Control'] = array(
|
|
|
|
|
'no-store, no-cache, must-revalidate',
|
|
|
|
|
'post-check=0, pre-check=0',
|
|
|
|
|
'max-age=0'
|
|
|
|
|
);
|
|
|
|
|
$this->headers['Pragma'] = 'no-cache';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$expires = is_int($expires) ? $expires : strtotime($expires);
|
|
|
|
|
$this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT';
|
|
|
|
|
$this->headers['Cache-Control'] = 'max-age='.($expires - time());
|
|
|
|
|
}
|
|
|
|
|
if ($expires === false) {
|
|
|
|
|
$this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
|
|
|
|
|
$this->headers['Cache-Control'] = array(
|
|
|
|
|
'no-store, no-cache, must-revalidate',
|
|
|
|
|
'post-check=0, pre-check=0',
|
|
|
|
|
'max-age=0'
|
|
|
|
|
);
|
|
|
|
|
$this->headers['Pragma'] = 'no-cache';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$expires = is_int($expires) ? $expires : strtotime($expires);
|
|
|
|
|
$this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT';
|
|
|
|
|
$this->headers['Cache-Control'] = 'max-age='.($expires - time());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|