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
|
class Store implements StoreInterface
|
||||||
{
|
{
|
||||||
private $root;
|
protected $root;
|
||||||
private $keyCache;
|
private $keyCache;
|
||||||
private $locks;
|
private $locks;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class Store implements StoreInterface
|
|||||||
|
|
||||||
// write the response body to the entity store if this is the original response
|
// write the response body to the entity store if this is the original response
|
||||||
if (!$response->headers->has('X-Content-Digest')) {
|
if (!$response->headers->has('X-Content-Digest')) {
|
||||||
$digest = 'en'.sha1($response->getContent());
|
$digest = $this->generateContentDigest($response);
|
||||||
|
|
||||||
if (false === $this->save($digest, $response->getContent())) {
|
if (false === $this->save($digest, $response->getContent())) {
|
||||||
throw new \RuntimeException('Unable to store the entity.');
|
throw new \RuntimeException('Unable to store the entity.');
|
||||||
@ -192,6 +192,18 @@ class Store implements StoreInterface
|
|||||||
return $key;
|
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.
|
* Invalidates all cache entries that match the request.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user