Merge pull request #58642 from nextcloud/jtr/perf-s3-external-cache-sizing

perf(files_external): Increase S3 cache caps
This commit is contained in:
Côme Chilliet 2026-03-02 13:36:01 +01:00 committed by GitHub
commit e7c4dbf2cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,9 +53,7 @@ class AmazonS3 extends Common {
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 @@ class AmazonS3 extends Common {
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 @@ class AmazonS3 extends Common {
}
protected function clearBucket(): bool {
$this->clearCache();
$this->clearCaches();
return $this->batchDelete();
}