Merge selected commits from branch 'wkpark@varnish_cache'

This commit is contained in:
Kijin Sung 2015-07-12 14:08:39 +09:00
commit 0bbbc88377
3 changed files with 23 additions and 17 deletions

View file

@ -358,6 +358,7 @@ class Context
}
else
{
$this->isSessionStarted = FALSE;
$_SESSION = array();
}
@ -475,6 +476,26 @@ class Context
session_write_close();
}
/**
* set Cache-Control header
*
* @return void
*/
function setCacheControl($public = 'public', $nocache = false)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$public = !empty($public) ? $public.', ' : '';
header("Cache-Control: ".$public."must-revalidate, post-check=0, pre-check=0");
if ($nocache)
{
header("Cache-Control: no-store, no-cache, must-revalidate", false);
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Pragma: no-cache");
}
}
/**
* Load the database information
*