Skip to content

Commit

Permalink
TASK: Adjust guzzle requirements to be in line with neos 8 and use fl…
Browse files Browse the repository at this point in the history
…ushByTags
  • Loading branch information
mficzel committed May 5, 2022
1 parent 4d943ed commit 0a9f741
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions Classes/Aspects/ContentCacheAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ public function interceptNodeCacheFlush(JoinPointInterface $joinPoint)
$object = $joinPoint->getProxy();

$tags = ObjectAccess::getProperty($object, 'tagsToFlush', true);
foreach ($tags as $tag => $_) {
$tag = $this->sanitizeTag($tag);
$this->cacheFrontend->flushByTag($tag);
}
$tags = array_map([$this, 'sanitizeTag'],$tags);
$this->cacheFrontend->flushByTags($tags);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Classes/Middleware/RequestCacheMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use function GuzzleHttp\Psr7\parse_response;
use GuzzleHttp\Psr7\Message;
use function GuzzleHttp\Psr7\str;

class RequestCacheMiddleware implements MiddlewareInterface
Expand Down Expand Up @@ -72,7 +72,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

if ($cacheEntry = $this->cacheFrontend->get($entryIdentifier)) {
$age = time() - $cacheEntry['timestamp'];
$response = parse_response($cacheEntry['response']);
$response = Message::parseResponse($cacheEntry['response']);
return $response
->withHeader('Age', $age)
->withHeader(self::HEADER_INFO, 'HIT: ' . $entryIdentifier);
Expand Down Expand Up @@ -105,7 +105,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
->withHeader('Cache-Control', 'public, max-age=' . $publicLifetime);
}

$this->cacheFrontend->set($entryIdentifier,[ 'timestamp' => time(), 'response' => str($response) ], $tags, $lifetime);
$this->cacheFrontend->set($entryIdentifier,[ 'timestamp' => time(), 'response' => Message::toString($response) ], $tags, $lifetime);
$response->getBody()->rewind();
return $response->withHeader(self::HEADER_INFO, 'MISS: ' . $entryIdentifier);
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"name": "flowpack/fullpagecache",
"license": "MIT",
"require": {
"neos/neos": "^7.0 || ^8.0 || dev-master",
"guzzlehttp/psr7": "~1.4"
"neos/neos": "^8.0 || dev-master",
"guzzlehttp/psr7": "^1.7, !=1.8.0 || ~2.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 0a9f741

Please sign in to comment.