Skip to content

Commit 0a9f741

Browse files
committed
TASK: Adjust guzzle requirements to be in line with neos 8 and use flushByTags
1 parent 4d943ed commit 0a9f741

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

Classes/Aspects/ContentCacheAspect.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ public function interceptNodeCacheFlush(JoinPointInterface $joinPoint)
4646
$object = $joinPoint->getProxy();
4747

4848
$tags = ObjectAccess::getProperty($object, 'tagsToFlush', true);
49-
foreach ($tags as $tag => $_) {
50-
$tag = $this->sanitizeTag($tag);
51-
$this->cacheFrontend->flushByTag($tag);
52-
}
49+
$tags = array_map([$this, 'sanitizeTag'],$tags);
50+
$this->cacheFrontend->flushByTags($tags);
5351
}
5452

5553
/**

Classes/Middleware/RequestCacheMiddleware.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Psr\Http\Message\ServerRequestInterface;
1010
use Psr\Http\Server\MiddlewareInterface;
1111
use Psr\Http\Server\RequestHandlerInterface;
12-
use function GuzzleHttp\Psr7\parse_response;
12+
use GuzzleHttp\Psr7\Message;
1313
use function GuzzleHttp\Psr7\str;
1414

1515
class RequestCacheMiddleware implements MiddlewareInterface
@@ -72,7 +72,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
7272

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

108-
$this->cacheFrontend->set($entryIdentifier,[ 'timestamp' => time(), 'response' => str($response) ], $tags, $lifetime);
108+
$this->cacheFrontend->set($entryIdentifier,[ 'timestamp' => time(), 'response' => Message::toString($response) ], $tags, $lifetime);
109109
$response->getBody()->rewind();
110110
return $response->withHeader(self::HEADER_INFO, 'MISS: ' . $entryIdentifier);
111111
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"name": "flowpack/fullpagecache",
55
"license": "MIT",
66
"require": {
7-
"neos/neos": "^7.0 || ^8.0 || dev-master",
8-
"guzzlehttp/psr7": "~1.4"
7+
"neos/neos": "^8.0 || dev-master",
8+
"guzzlehttp/psr7": "^1.7, !=1.8.0 || ~2.0"
99
},
1010
"autoload": {
1111
"psr-4": {

0 commit comments

Comments
 (0)