@@ -51,7 +51,11 @@ public function __construct(FactoryInterface $factory, Connection $conn, array $
51
51
52
52
$ this ->caches = $ caches ;
53
53
$ this ->keySanitizer = static function ($ cacheKey ) {
54
- return str_replace (' ' , '_ ' , $ cacheKey );
54
+ return str_replace (
55
+ ['% ' , '. ' ],
56
+ ['_ ' , '| ' ],
57
+ \urlencode ($ cacheKey )
58
+ );
55
59
};
56
60
}
57
61
@@ -259,7 +263,7 @@ public function getNode($path)
259
263
$ cacheKey = "nodes: $ path, " .$ this ->workspaceName ;
260
264
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
261
265
262
- if (false !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
266
+ if (null !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
263
267
if ('ItemNotFoundException ' === $ result ) {
264
268
throw new ItemNotFoundException ("Item ' $ path' not found in workspace ' $ this ->workspaceName ' " );
265
269
}
@@ -319,7 +323,7 @@ protected function getSystemIdForNodeUuid($uuid, $workspaceName = null)
319
323
$ cacheKey = "id: $ uuid, " .$ workspaceName ;
320
324
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
321
325
322
- if (false !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
326
+ if (null !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
323
327
if ('false ' === $ result ) {
324
328
return false ;
325
329
}
@@ -495,7 +499,7 @@ public function getNodePathForIdentifier($uuid, $workspace = null)
495
499
$ cacheKey = "nodes by uuid: $ uuid, $ this ->workspaceName " ;
496
500
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
497
501
498
- if (false !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
502
+ if (null !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
499
503
if ('ItemNotFoundException ' === $ result ) {
500
504
throw new ItemNotFoundException ("no item found with uuid $ uuid " );
501
505
}
@@ -560,7 +564,7 @@ public function getReferences($path, $name = null)
560
564
$ cacheKey = "nodes references: $ path, $ name, " . $ this ->workspaceName ;
561
565
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
562
566
563
- if (false !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
567
+ if (null !== ($ result = $ this ->get ('nodes ' , $ cacheKey ))) {
564
568
return $ result ;
565
569
}
566
570
@@ -608,7 +612,7 @@ public function query(Query $query)
608
612
$ cacheKey = "query: {$ query ->getStatement ()}, {$ query ->getLimit ()}, {$ query ->getOffset ()}, {$ query ->getLanguage ()}, " .$ this ->workspaceName ;
609
613
$ cacheKey = $ this ->sanitizeKey ($ cacheKey );
610
614
611
- if (false !== ($ result = $ this ->get ('query ' , $ cacheKey ))) {
615
+ if (null !== ($ result = $ this ->get ('query ' , $ cacheKey ))) {
612
616
return $ result ;
613
617
}
614
618
@@ -667,6 +671,12 @@ private function get(string $name, string $key)
667
671
return $ this ->caches [$ name ]->get ($ key );
668
672
}
669
673
670
- return $ this ->caches [$ name ]->fetch ($ key );
674
+ $ result = $ this ->caches [$ name ]->fetch ($ key );
675
+
676
+ if ($ result === false ) {
677
+ return null ;
678
+ }
679
+
680
+ return $ result ;
671
681
}
672
682
}
0 commit comments