Skip to content

Commit

Permalink
Fix usage of symfony cache with shared max age 0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jan 23, 2019
1 parent 74d1738 commit e2fda60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@ CHANGELOG for Sulu
==================

* release/1.5
* BUGFIX #4385 [SuluHttpCacheBundle] Fix usage of symfony cache with s-max-age 0
* ENHANCEMENT #4367 [WebsiteBundle] Remove false deprecation of WebsiteController::renderStructure
* BUGFIX #4376 [SecurityBundle] Exclude role permissions in user API to improve performance

Expand Down
8 changes: 6 additions & 2 deletions src/Sulu/Component/HttpCache/Handler/PublicHandler.php
Expand Up @@ -85,9 +85,13 @@ public function updateResponse(Response $response, StructureInterface $structure
// mark the response as either public or private
$response->setPublic();

// set the private and shared max age
// set the private max age
$response->setMaxAge($this->maxAge);
$response->setSharedMaxAge($this->sharedMaxAge);

// set shared max age only when not 0 else symfony cache will not work
if ($this->sharedMaxAge) {
$response->setSharedMaxAge($this->sharedMaxAge);
}

$proxyTtl = $this->usePageTtl ?
$response->getAge() + $cacheLifetime :
Expand Down

0 comments on commit e2fda60

Please sign in to comment.