diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 4da56c9527d9b..dd63e0a55a8dd 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -53,9 +53,7 @@ public function __construct(array $parameters) { parent::__construct($parameters); $this->parseParams($parameters); $this->id = 'amazon::external::' . md5($this->params['hostname'] . ':' . $this->params['bucket'] . ':' . $this->params['key']); - $this->objectCache = new CappedMemoryCache(); - $this->directoryCache = new CappedMemoryCache(); - $this->filesCache = new CappedMemoryCache(); + $this->initCaches(); $this->mimeDetector = Server::get(IMimeTypeDetector::class); /** @var ICacheFactory $cacheFactory */ $cacheFactory = Server::get(ICacheFactory::class); @@ -84,10 +82,16 @@ private function cleanKey(string $path): string { return $path; } - private function clearCache(): void { - $this->objectCache = new CappedMemoryCache(); - $this->directoryCache = new CappedMemoryCache(); - $this->filesCache = new CappedMemoryCache(); + private function initCaches(): void { + $this->objectCache = new CappedMemoryCache(2048); + $this->directoryCache = new CappedMemoryCache(8192); + $this->filesCache = new CappedMemoryCache(4096); + } + + private function clearCaches(): void { + $this->objectCache->clear(); + $this->directoryCache->clear(); + $this->filesCache->clear(); } private function invalidateCache(string $key): void { @@ -246,7 +250,7 @@ public function rmdir(string $path): bool { } protected function clearBucket(): bool { - $this->clearCache(); + $this->clearCaches(); return $this->batchDelete(); }