Merge pull request #2747 from owncloud/cache-contructed-cache-objects

Remember the contructed OC\Files\Cache\* classes in OC\Files\Storage\Com...
This commit is contained in:
Jörn Friedrich Dreyer 2013-04-10 08:09:09 -07:00
commit 121c8bd303
1 changed files with 20 additions and 4 deletions

View File

@ -21,6 +21,10 @@ namespace OC\Files\Storage;
*/ */
abstract class Common implements \OC\Files\Storage\Storage { abstract class Common implements \OC\Files\Storage\Storage {
private $cache;
private $scanner;
private $permissioncache;
private $watcher;
public function __construct($parameters) { public function __construct($parameters) {
} }
@ -269,19 +273,31 @@ abstract class Common implements \OC\Files\Storage\Storage {
} }
public function getCache($path = '') { 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 = '') { 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 = '') { 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 = '') { 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;
} }
/** /**