@@ -61,14 +61,15 @@ class Cache implements ICache {
6161 */
6262 protected array $ partial = [];
6363 protected string $ storageId ;
64- protected Storage $ storageCache ;
64+ protected ? Storage $ storageCache = null ;
6565 protected IMimeTypeLoader $ mimetypeLoader ;
6666 protected IDBConnection $ connection ;
6767 protected SystemConfig $ systemConfig ;
6868 protected LoggerInterface $ logger ;
6969 protected QuerySearchHelper $ querySearchHelper ;
7070 protected IEventDispatcher $ eventDispatcher ;
7171 protected IFilesMetadataManager $ metadataManager ;
72+ private CacheDependencies $ cacheDependencies ;
7273
7374 public function __construct (
7475 private IStorage $ storage ,
@@ -83,7 +84,7 @@ public function __construct(
8384 if (!$ dependencies ) {
8485 $ dependencies = Server::get (CacheDependencies::class);
8586 }
86- $ this ->storageCache = new Storage ( $ this -> storage , true , $ dependencies-> getConnection ()) ;
87+ $ this ->cacheDependencies = $ dependencies ;
8788 $ this ->mimetypeLoader = $ dependencies ->getMimeTypeLoader ();
8889 $ this ->connection = $ dependencies ->getConnection ();
8990 $ this ->systemConfig = $ dependencies ->getSystemConfig ();
@@ -101,6 +102,9 @@ protected function getQueryBuilder() {
101102 }
102103
103104 public function getStorageCache (): Storage {
105+ if (!$ this ->storageCache ) {
106+ $ this ->storageCache = new Storage ($ this ->storage , true , $ this ->cacheDependencies ->getConnection ());
107+ }
104108 return $ this ->storageCache ;
105109 }
106110
@@ -111,7 +115,7 @@ public function getStorageCache(): Storage {
111115 */
112116 #[\Override]
113117 public function getNumericStorageId () {
114- return $ this ->storageCache ->getNumericId ();
118+ return $ this ->getStorageCache () ->getNumericId ();
115119 }
116120
117121 /**
0 commit comments