diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-11-17 18:47:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-17 18:47:39 +0100 |
commit | 02bfd915534d5dfaee3c5c873b84cc14657bed15 (patch) | |
tree | 090698dfec1a4ac44eaacee621113228554626d4 /apps/files_sharing/lib/Cache.php | |
parent | e36293195f7870ac5e85a7e1b0d10a0927a084fb (diff) | |
parent | 30e7c27d860bf67ff37778d00fb812aefa8fefa5 (diff) | |
download | nextcloud-server-02bfd915534d5dfaee3c5c873b84cc14657bed15.tar.gz nextcloud-server-02bfd915534d5dfaee3c5c873b84cc14657bed15.zip |
Merge pull request #2176 from nextcloud/share-cache-root-info
reuse the known rootinfo in the shared cache when possible
Diffstat (limited to 'apps/files_sharing/lib/Cache.php')
-rw-r--r-- | apps/files_sharing/lib/Cache.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 6444dbb8a36..21f3ff622f9 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -57,6 +57,8 @@ class Cache extends CacheJail { */ private $sourceCache; + private $rootUnchanged = true; + /** * @param \OCA\Files_Sharing\SharedStorage $storage * @param IStorage $sourceStorage @@ -81,6 +83,33 @@ class Cache extends CacheJail { } } + public function get($file) { + if ($this->rootUnchanged && ($file === '' || $file === $this->sourceRootInfo->getId())) { + return $this->formatCacheEntry(clone $this->sourceRootInfo); + } + return parent::get($file); + } + + public function update($id, array $data) { + $this->rootUnchanged = false; + parent::update($id, $data); + } + + public function insert($file, array $data) { + $this->rootUnchanged = false; + return parent::insert($file, $data); + } + + public function remove($file) { + $this->rootUnchanged = false; + parent::remove($file); + } + + public function moveFromCache(\OCP\Files\Cache\ICache $sourceCache, $sourcePath, $targetPath) { + $this->rootUnchanged = false; + return parent::moveFromCache($sourceCache, $sourcePath, $targetPath); + } + protected function formatCacheEntry($entry) { $path = isset($entry['path']) ? $entry['path'] : ''; $entry = parent::formatCacheEntry($entry); |