Skip to content

Commit

Permalink
Merge pull request #2 from jonaguera/master
Browse files Browse the repository at this point in the history
Fix etags problem
  • Loading branch information
ddniel16 authored Oct 18, 2022
2 parents 15d475e + a1a0473 commit a479338
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/RedisStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public function __construct(
$this->_timeOut = $timeOut;
$this->_digestKeyPrefix= $digestKeyPrefix;
$this->_metadataKeyPrefix = $metadataKeyPrefix;

}

/**
Expand All @@ -48,9 +47,7 @@ public function __construct(
*/
public function lookup(Request $request)
{

$key = $this->getMetadataKey($request);

$entries = $this->getMetadata($key);
if (empty($entries)) {
return null;
Expand Down Expand Up @@ -102,7 +99,6 @@ public function write(Request $request, Response $response)
{

$metadataKey = $this->getMetadataKey($request);

// write the response body to the entity store if this is the original response
if ($response->headers->has('X-Content-Digest') === false) {

Expand All @@ -112,7 +108,6 @@ public function write(Request $request, Response $response)
}

$response->headers->set('X-Content-Digest', $digest);
$response->headers->set('Etag', $digest);

}

Expand Down Expand Up @@ -298,13 +293,11 @@ public function cleanup()
*/
private function getMetadataKey(Request $request)
{

if (isset($this->_keyCache[$request])) {
return $this->_keyCache[$request];
}

$this->_keyCache[$request] = $this->_metadataKeyPrefix . '::' . sha1(
$request->getRequestUri()
$request->getSchemeAndHttpHost().$request->getRequestUri()
);

return $this->_keyCache[$request];
Expand Down Expand Up @@ -334,11 +327,10 @@ protected function generateDigestKey(
Request $request
)
{

return sprintf(
'%s::%s',
$this->_digestKeyPrefix,
md5($request->getRequestUri())
md5($request->getSchemeAndHttpHost().$request->getRequestUri())
);

}
Expand Down

0 comments on commit a479338

Please sign in to comment.