moving some laravel classes around, switching alias to reflect changes. added some factories. removed system ioc container config file.

This commit is contained in:
Taylor Otwell
2011-11-11 21:27:30 -06:00
parent b625ebdcf3
commit b6ab0b08ce
23 changed files with 384 additions and 388 deletions

34
laravel/cache/drivers/factory.php vendored Normal file
View File

@@ -0,0 +1,34 @@
<?php namespace Laravel\Cache\Drivers;
use Laravel\Config;
class Factory {
/**
* Create a new cache driver instance.
*
* @param string $driver
* @return Driver
*/
public static function make($driver)
{
switch ($driver)
{
case 'apc':
return new APC(Config::get('cache.key'));
case 'file':
return new File(CACHE_PATH);
case 'memcached':
return new Memcached(\Laravel\Memcached::instance(), Config::get('cache.key'));
case 'redis':
return new Redis(\Laravel\Redis::db());
default:
throw new \Exception("Cache driver {$driver} is not supported.");
}
}
}

View File

@@ -1,4 +1,8 @@
<?php namespace Laravel\Cache; use Laravel\IoC, Laravel\Config;
<?php namespace Laravel\Cache;
use Laravel\Redis;
use Laravel\Config;
use Laravel\Memcached;
class Manager {
@@ -37,7 +41,7 @@ class Manager {
throw new \Exception("Cache driver [$driver] is not supported.");
}
return static::$drivers[$driver] = IoC::core("cache.{$driver}");
return static::$drivers[$driver] = Drivers\Factory::make($driver);
}
return static::$drivers[$driver];