]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remember the contructed OC\Files\Cache\* classes in OC\Files\Storage\Common
authorBart Visscher <bartv@thisnet.nl>
Fri, 5 Apr 2013 15:20:08 +0000 (17:20 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 5 Aug 2013 10:14:19 +0000 (12:14 +0200)
lib/files/storage/common.php

index d1386acd44e1ca653f05516ede600df397db5507..f2651f7707069d76aaf209650dda4b782a51dd6c 100644 (file)
@@ -21,6 +21,10 @@ namespace OC\Files\Storage;
  */
 
 abstract class Common implements \OC\Files\Storage\Storage {
+       private $cache;
+       private $scanner;
+       private $permissioncache;
+       private $watcher;
 
        public function __construct($parameters) {
        }
@@ -263,19 +267,31 @@ abstract class Common implements \OC\Files\Storage\Storage {
        }
 
        public function getCache($path = '') {
-               return new \OC\Files\Cache\Cache($this);
+               if (!isset($this->cache)) {
+                       $this->cache = new \OC\Files\Cache\Cache($this);
+               }
+               return $this->cache;
        }
 
        public function getScanner($path = '') {
-               return new \OC\Files\Cache\Scanner($this);
+               if (!isset($this->scanner)) {
+                       $this->scanner = new \OC\Files\Cache\Scanner($this);
+               }
+               return $this->scanner;
        }
 
        public function getPermissionsCache($path = '') {
-               return new \OC\Files\Cache\Permissions($this);
+               if (!isset($this->permissioncache)) {
+                       $this->permissioncache = new \OC\Files\Cache\Permissions($this);
+               }
+               return $this->permissioncache;
        }
 
        public function getWatcher($path = '') {
-               return new \OC\Files\Cache\Watcher($this);
+               if (!isset($this->watcher)) {
+                       $this->watcher = new \OC\Files\Cache\Watcher($this);
+               }
+               return $this->watcher;
        }
 
        /**