@@ -50,8 +50,12 @@ public function __construct(FactoryInterface $factory, Connection $conn, array $
50
50
}
51
51
}
52
52
$ this ->caches = $ caches ;
53
- $ this ->keySanitizer = static function (string $ cacheKey ): string {
54
- return str_replace (' ' , '_ ' , $ cacheKey );
53
+ $ this ->keySanitizer = static function ($ cacheKey ) {
54
+ return str_replace (
55
+ ['% ' , '. ' ],
56
+ ['_ ' , '| ' ],
57
+ \urlencode ($ cacheKey )
58
+ );
55
59
};
56
60
}
57
61
@@ -219,7 +223,7 @@ public function getNode(string $path): \stdClass
219
223
$ cacheKey = "nodes: $ path, " .$ this ->workspaceName ;
220
224
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
221
225
222
- if (false !== ($ result = $ this ->caches ['nodes ' ]->get ($ cacheKey ))) {
226
+ if (null !== ($ result = $ this ->caches ['nodes ' ]->get ($ cacheKey ))) {
223
227
if ('ItemNotFoundException ' === $ result ) {
224
228
throw new ItemNotFoundException ("Item ' $ path' not found in workspace ' $ this ->workspaceName ' " );
225
229
}
@@ -354,7 +358,7 @@ public function getNodePathForIdentifier($uuid, $workspace = null): string
354
358
$ cacheKey = "nodes by uuid: $ uuid, $ this ->workspaceName " ;
355
359
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
356
360
357
- if (false !== ($ result = $ this ->caches ['nodes ' ]->get ($ cacheKey ))) {
361
+ if (null !== ($ result = $ this ->caches ['nodes ' ]->get ($ cacheKey ))) {
358
362
if ('ItemNotFoundException ' === $ result ) {
359
363
throw new ItemNotFoundException ("no item found with uuid $ uuid " );
360
364
}
@@ -407,7 +411,7 @@ public function getReferences($path, $name = null): array
407
411
$ cacheKey = "nodes references: $ path, $ name, " .$ this ->workspaceName ;
408
412
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
409
413
410
- if (false !== ($ result = $ this ->caches ['nodes ' ]->get ($ cacheKey ))) {
414
+ if (null !== ($ result = $ this ->caches ['nodes ' ]->get ($ cacheKey ))) {
411
415
return $ result ;
412
416
}
413
417
@@ -449,7 +453,7 @@ public function query(Query $query): array
449
453
$ cacheKey = "query: {$ query ->getStatement ()}, {$ query ->getLimit ()}, {$ query ->getOffset ()}, {$ query ->getLanguage ()}, " .$ this ->workspaceName ;
450
454
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
451
455
452
- if (false !== ($ result = $ this ->caches ['query ' ]->get ($ cacheKey ))) {
456
+ if (null !== ($ result = $ this ->caches ['query ' ]->get ($ cacheKey ))) {
453
457
return $ result ;
454
458
}
455
459
0 commit comments