Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php @ 12:7a779792577d
Update Drupal core to v8.4.5 (via Composer)
author | Chris Cannam |
---|---|
date | Fri, 23 Feb 2018 15:52:07 +0000 |
parents | 4c8ae668cc8c |
children | c2387f117808 |
comparison
equal
deleted
inserted
replaced
11:bfffd8d7479a | 12:7a779792577d |
---|---|
37 /** | 37 /** |
38 * {@inheritdoc} | 38 * {@inheritdoc} |
39 */ | 39 */ |
40 public function add(Response $response) | 40 public function add(Response $response) |
41 { | 41 { |
42 if ($response->isValidateable()) { | 42 if (!$response->isFresh() || !$response->isCacheable()) { |
43 $this->cacheable = false; | 43 $this->cacheable = false; |
44 } else { | 44 } else { |
45 $maxAge = $response->getMaxAge(); | 45 $maxAge = $response->getMaxAge(); |
46 $this->ttls[] = $response->getTtl(); | 46 $this->ttls[] = $response->getTtl(); |
47 $this->maxAges[] = $maxAge; | 47 $this->maxAges[] = $maxAge; |
68 // their own cache, because some of the response content comes from | 68 // their own cache, because some of the response content comes from |
69 // at least one embedded response (which likely has a different caching strategy). | 69 // at least one embedded response (which likely has a different caching strategy). |
70 if ($response->isValidateable()) { | 70 if ($response->isValidateable()) { |
71 $response->setEtag(null); | 71 $response->setEtag(null); |
72 $response->setLastModified(null); | 72 $response->setLastModified(null); |
73 } | |
74 | |
75 if (!$response->isFresh()) { | |
73 $this->cacheable = false; | 76 $this->cacheable = false; |
74 } | 77 } |
75 | 78 |
76 if (!$this->cacheable) { | 79 if (!$this->cacheable) { |
77 $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); | 80 $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); |