Skip to content

Commit 430975c

Browse files
perf(files_external): Increase S3 metadata cache caps
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent dbdba09 commit 430975c

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎apps/files_external/lib/Lib/Storage/AmazonS3.php‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ public function __construct(array $parameters) {
5353
parent::__construct($parameters);
5454
$this->parseParams($parameters);
5555
$this->id = 'amazon::external::' . md5($this->params['hostname'] . ':' . $this->params['bucket'] . ':' . $this->params['key']);
56-
$this->objectCache = new CappedMemoryCache();
57-
$this->directoryCache = new CappedMemoryCache();
58-
$this->filesCache = new CappedMemoryCache();
56+
$this->initCaches();
5957
$this->mimeDetector = Server::get(IMimeTypeDetector::class);
6058
/** @var ICacheFactory $cacheFactory */
6159
$cacheFactory = Server::get(ICacheFactory::class);
@@ -84,10 +82,16 @@ private function cleanKey(string $path): string {
8482
return $path;
8583
}
8684

87-
private function clearCache(): void {
88-
$this->objectCache = new CappedMemoryCache();
89-
$this->directoryCache = new CappedMemoryCache();
90-
$this->filesCache = new CappedMemoryCache();
85+
private function initCaches(): void {
86+
$this->objectCache = new CappedMemoryCache(2048);
87+
$this->directoryCache = new CappedMemoryCache(8192);
88+
$this->filesCache = new CappedMemoryCache(4096);
89+
}
90+
91+
private function clearCaches(): void {
92+
$this->objectCache->clear();
93+
$this->directoryCache->clear();
94+
$this->filesCache->clear();
9195
}
9296

9397
private function invalidateCache(string $key): void {
@@ -246,7 +250,7 @@ public function rmdir(string $path): bool {
246250
}
247251

248252
protected function clearBucket(): bool {
249-
$this->clearCache();
253+
$this->clearCaches();
250254
return $this->batchDelete();
251255
}
252256

0 commit comments

Comments
 (0)