aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorClement Wong <git@clement.hk>2020-05-10 20:22:47 +0200
committerClement Wong <git@clement.hk>2020-05-10 20:24:14 +0200
commite9be3a9090d89f7d3e4c2c0ec51ed4e68499985d (patch)
treed2c2f53397ddcedbef2095c45e23984c012f59d2 /lib/public
parent401210d259be88918ea880aa32fde9e81fbe8bb2 (diff)
downloadnextcloud-server-e9be3a9090d89f7d3e4c2c0ec51ed4e68499985d.tar.gz
nextcloud-server-e9be3a9090d89f7d3e4c2c0ec51ed4e68499985d.zip
Add public argument to Http cacheFor()
Signed-off-by: Clement Wong <git@clement.hk>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/AppFramework/Http/Response.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index 27a2fd3a008..6f418e42553 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -105,12 +105,11 @@ class Response {
* @return $this
* @since 6.0.0 - return value was added in 7.0.0
*/
- public function cacheFor(int $cacheSeconds) {
+ public function cacheFor(int $cacheSeconds, bool $public = false) {
if ($cacheSeconds > 0) {
- $this->addHeader('Cache-Control', 'private, max-age=' . $cacheSeconds . ', must-revalidate');
-
- // Old scool prama caching
- $this->addHeader('Pragma', 'private');
+ $pragma = $public ? 'public' : 'private';
+ $this->addHeader('Cache-Control', $pragma . ', max-age=' . $cacheSeconds . ', must-revalidate');
+ $this->addHeader('Pragma', $pragma);
// Set expires header
$expires = new \DateTime();