From: Michael J. Rubinsky Date: Mon, 24 May 2010 18:42:13 +0000 (-0400) Subject: Cache the vfs in the factory X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d46811cc34b39c5ad0af6166680941a3bee01d74;p=horde.git Cache the vfs in the factory --- diff --git a/framework/Core/lib/Horde/Core/Factory/Vfs.php b/framework/Core/lib/Horde/Core/Factory/Vfs.php index 134c59b01..382ac0e77 100644 --- a/framework/Core/lib/Horde/Core/Factory/Vfs.php +++ b/framework/Core/lib/Horde/Core/Factory/Vfs.php @@ -22,6 +22,13 @@ class Horde_Core_Factory_Vfs { /** + * Instances. + * + * @var array + */ + private $_instances = array(); + + /** * The injector. * * @var Horde_Injector @@ -47,8 +54,12 @@ class Horde_Core_Factory_Vfs */ public function getVfs($scope) { - $params = Horde::getVFSConfig($scope); - return VFS::singleton($params['type'], $params['params']); + if (empty($this->_instances[$scope])) { + $params = Horde::getVFSConfig($scope); + $this->_instances[$scope] = VFS::singleton($params['type'], $params['params']); + } + + return $this->_instances[$scope]; } } \ No newline at end of file