@@ -62,14 +62,15 @@ class Cache implements ICache {
6262 */
6363 protected array $ partial = [];
6464 protected string $ storageId ;
65- protected Storage $ storageCache ;
65+ protected ? Storage $ storageCache = null ;
6666 protected IMimeTypeLoader $ mimetypeLoader ;
6767 protected IDBConnection $ connection ;
6868 protected SystemConfig $ systemConfig ;
6969 protected LoggerInterface $ logger ;
7070 protected QuerySearchHelper $ querySearchHelper ;
7171 protected IEventDispatcher $ eventDispatcher ;
7272 protected IFilesMetadataManager $ metadataManager ;
73+ private CacheDependencies $ cacheDependencies ;
7374
7475 public function __construct (
7576 private IStorage $ storage ,
@@ -84,7 +85,7 @@ public function __construct(
8485 if (!$ dependencies ) {
8586 $ dependencies = Server::get (CacheDependencies::class);
8687 }
87- $ this ->storageCache = new Storage ( $ this -> storage , true , $ dependencies-> getConnection ()) ;
88+ $ this ->cacheDependencies = $ dependencies ;
8889 $ this ->mimetypeLoader = $ dependencies ->getMimeTypeLoader ();
8990 $ this ->connection = $ dependencies ->getConnection ();
9091 $ this ->systemConfig = $ dependencies ->getSystemConfig ();
@@ -111,7 +112,10 @@ public function getStorageCache(): Storage {
111112 * @return int
112113 */
113114 public function getNumericStorageId () {
114- return $ this ->storageCache ->getNumericId ();
115+ if (!$ this ->storageCache ) {
116+ $ this ->storageCache = new Storage ($ this ->storage , true , $ this ->cacheDependencies ->getConnection ());
117+ }
118+ return $ this ->getStorageCache ()->getNumericId ();
115119 }
116120
117121 /**
0 commit comments