diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 25d4ab4d87..1b624230d4 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -24,7 +24,7 @@ use Symfony\Component\HttpFoundation\Response; */ class Store implements StoreInterface { - private $root; + protected $root; private $keyCache; private $locks; @@ -154,7 +154,7 @@ class Store implements StoreInterface // write the response body to the entity store if this is the original response if (!$response->headers->has('X-Content-Digest')) { - $digest = 'en'.sha1($response->getContent()); + $digest = $this->generateContentDigest($response); if (false === $this->save($digest, $response->getContent())) { throw new \RuntimeException('Unable to store the entity.'); @@ -192,6 +192,18 @@ class Store implements StoreInterface return $key; } + /** + * Returns content digest for $response. + * + * @param Response $response + * + * @return string + */ + protected function generateContentDigest(Response $response) + { + return 'en'.sha1($response->getContent()); + } + /** * Invalidates all cache entries that match the request. *