diff options
Diffstat (limited to 'app/Core/Http')
-rw-r--r-- | app/Core/Http/Response.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Core/Http/Response.php b/app/Core/Http/Response.php index d098f519..37349ca5 100644 --- a/app/Core/Http/Response.php +++ b/app/Core/Http/Response.php @@ -14,6 +14,24 @@ use Kanboard\Core\Csv; class Response extends Base { /** + * Send headers to cache a resource + * + * @access public + * @param integer $duration + * @param string $etag + */ + public function cache($duration, $etag = '') + { + header('Pragma: cache'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $duration) . ' GMT'); + header('Cache-Control: public, max-age=' . $duration); + + if ($etag) { + header('ETag: "' . $etag . '"'); + } + } + + /** * Send no cache headers * * @access public |