From: Julius Härtl Date: Tue, 7 Jul 2020 08:22:22 +0000 (+0200) Subject: Reuse cache for directory mtime/size if filesystem changes can be ignored X-Git-Tag: v20.0.0beta1~235^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f5cc34c9c202eccf0a3cda95fc74e077dc49d80c;p=nextcloud-server.git Reuse cache for directory mtime/size if filesystem changes can be ignored Signed-off-by: Julius Härtl --- diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 641a26b20ee..4a49f70dd58 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -45,6 +45,7 @@ use Aws\S3\S3Client; use Icewind\Streams\CallbackWrapper; use Icewind\Streams\IteratorDirectory; use OC\Cache\CappedMemoryCache; +use OC\Files\Cache\CacheEntry; use OC\Files\ObjectStore\S3ConnectionTrait; use OC\Files\ObjectStore\S3ObjectTrait; use OCP\Constants; @@ -374,6 +375,11 @@ class AmazonS3 extends \OC\Files\Storage\Common { //folders don't really exist $stat['size'] = -1; //unknown $stat['mtime'] = time(); + $cacheEntry = $this->getCache()->get($path); + if ($cacheEntry instanceof CacheEntry && $this->getMountOption('filesystem_check_changes', 1) !== 1) { + $stat['size'] = $cacheEntry->getSize(); + $stat['mtime'] = $cacheEntry->getMTime(); + } } else { $stat['size'] = $this->getContentLength($path); $stat['mtime'] = strtotime($this->getLastModified($path));