浏览代码

[HttpKernel] tweaked the default ESI cache strategy

Fabien Potencier 14 年之前
父节点
当前提交
9844685a40
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php

+ 4 - 3
src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php

@@ -60,9 +60,10 @@ class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface
             return;
         }
 
-        $maxAge = min($this->maxAges);
-        $response->setSharedMaxAge($maxAge);
+        if (null !== $maxAge = min($this->maxAges)) {
+            $response->setSharedMaxAge($maxAge);
+            $response->headers->set('Age', $maxAge - min($this->ttls));
+        }
         $response->setMaxAge(0);
-        $response->headers->set('Age', $maxAge - min($this->ttls));
     }
 }