Moved Cache\Factory functionality into Cache class.

This commit is contained in:
Taylor Otwell 2011-07-08 09:43:04 -07:00
parent c5a2752e8a
commit b1b2b932cc
1 changed files with 22 additions and 3 deletions

View File

@ -25,9 +25,28 @@ public static function driver($driver = null)
$driver = Config::get('cache.driver');
}
return (array_key_exists($driver, static::$drivers))
? static::$drivers[$driver]
: static::$drivers[$driver] = Cache\Factory::make($driver);
if ( ! array_key_exists($driver, static::$drivers))
{
switch ($driver)
{
case 'file':
static::$drivers[$driver] = new Cache\Driver\File;
break;
case 'memcached':
static::$drivers[$driver] = new Cache\Driver\Memcached;
break;
case 'apc':
static::$drivers[$driver] = new Cache\Driver\APC;
break;
default:
throw new \Exception("Cache driver [$driver] is not supported.");
}
}
return static::$drivers[$driver];
}
/**