Преглед на файлове

[HttpKernel] fixed default ESI cache strategy when the page does not contain ESIs

Fabien Potencier преди 14 години
родител
ревизия
0a3ff1c737
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php

+ 5 - 0
src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php

@@ -54,6 +54,11 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface
      */
     public function update(Response $response)
     {
+        // if we only have one Response, do nothing
+        if (1 === count($this->ttls)) {
+            return;
+        }
+
         if (!$this->cacheable) {
             $response->headers->set('Cache-Control', 'no-cache, must-revalidate');