/** * Create a new cache driver instance. * * @param string $driver * @return Driver */ protected static function factory($driver) { switch ($driver) { case 'apc': return new Drivers\APC(Config::get('cache.key')); case 'file': return new Drivers\File(CACHE_PATH); case 'memcached': return new Drivers\Memcached(Memcached::instance(), Config::get('cache.key')); case 'redis': return new Drivers\Redis(Redis::db()); default: throw new \DomainException("Cache driver {$driver} is not supported."); } }