diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-07-07 11:22:22 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-08-10 16:32:45 +0300 |
commit | f381c423992c6de4ba564a3434a9d20a8c5fd5de (patch) | |
tree | 10b95d62a80a58144d946d6dfddb268c156b1446 /apps | |
parent | f1c05b7b08055cbe04449eec5cd703ddab91c739 (diff) |
Reuse cache for directory mtime/size if filesystem changes can be ignored
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 3c8b6c29d5a..c9862d7fb34 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -44,6 +44,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; @@ -373,6 +374,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)); |