Added HttpCache\Store::generateContentDigest() + changed visibility
This commit is contained in:
parent
2d488b79f2
commit
d2920c94a1
@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user