*/
class Horde_Cache
{
- /**
- * Attempts to return a concrete Horde_Cache instance based on $driver.
- *
- * @param mixed $driver The type of concrete Horde_Cache subclass to
- * return. If $driver is an array, then we will look
- * in $driver[0]/lib/Cache/ for the subclass
- * implementation named $driver[1].php.
- * @param array $params A hash containing any additional configuration
- * or connection parameters a subclass might need.
- *
- * @return Horde_Cache The newly created concrete Horde_Cache instance.
- * @throws Horde_Exception
- */
- static public function factory($driver, $params = array())
- {
- if (is_array($driver)) {
- list($app, $driv_name) = $driver;
- $driver = basename($driv_name);
- } else {
- $driver = basename($driver);
- }
-
- if (empty($driver) || $driver == 'none') {
- return new Horde_Cache_Null($params);
- }
-
- $class = (empty($app) ? 'Horde' : $app) . '_Cache_' . ucfirst($driver);
- if (class_exists($class)) {
- return new $class($params);
- }
-
- throw new Horde_Exception('Class definition of ' . $class . ' not found.');
- }
-
}
$params['logger'] = $injector->getInstance('Horde_Log_Logger');
- return Horde_Cache::factory($driver, $params);
+ if (is_array($driver)) {
+ list($app, $driv_name) = $driver;
+ $driver = basename($driv_name);
+ } else {
+ $driver = basename($driver);
+ }
+
+ if (empty($driver) || $driver == 'none') {
+ return new Horde_Cache_Null($params);
+ }
+
+ $class = (empty($app) ? 'Horde' : $app) . '_Cache_' . ucfirst($driver);
+ if (class_exists($class)) {
+ return new $class($params);
+ }
+
+ throw new Horde_Exception('Class definition of ' . $class . ' not found.');
}
public function equals(Horde_Injector_Binder $binder)