Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -246,7 +250,7 @@ public function rmdir(string $path): bool {
}

protected function clearBucket(): bool {
$this->clearCache();
$this->clearCaches();
return $this->batchDelete();
}

Expand Down
Loading