summaryrefslogtreecommitdiffstats
path: root/lib/response.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-02-13 22:37:27 +0100
committerBart Visscher <bartv@thisnet.nl>2012-02-13 22:37:27 +0100
commit363fdc40b82f5e7ba0de7a11f031bc8d86af68be (patch)
tree25d103e50e2536a69db8cc54bf5d54e67fa6fb90 /lib/response.php
parent7208abf6184ddb1f5628c4665a848d5f1e04622b (diff)
downloadnextcloud-server-363fdc40b82f5e7ba0de7a11f031bc8d86af68be.tar.gz
nextcloud-server-363fdc40b82f5e7ba0de7a11f031bc8d86af68be.zip
OC_Response: Set Expire and Cache-Control headers in enableCaching
Diffstat (limited to 'lib/response.php')
-rw-r--r--lib/response.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/response.php b/lib/response.php
index f0d1aaab530..b5fca1cb227 100644
--- a/lib/response.php
+++ b/lib/response.php
@@ -11,9 +11,23 @@ class OC_Response {
const STATUS_NOT_MODIFIED = 304;
const STATUS_TEMPORARY_REDIRECT = 307;
- static public function enableCaching() {
- header('Cache-Control: cache');
- header('Pragma: cache');
+ static public function enableCaching($cache_time = null) {
+ if (is_numeric($cache_time)) {
+ header('Pragma: public');// enable caching in IE
+ if ($cache_time > 0) {
+ self::setExpiresHeader('PT'.$cache_time.'S');
+ header('Cache-Control: max-age='.$cache_time.', must-revalidate');
+ }
+ else {
+ self::setExpiresHeader(0);
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ }
+ }
+ else {
+ header('Cache-Control: cache');
+ header('Pragma: cache');
+ }
+
}
static public function setStatus($status) {