refactor cache driver method.
This commit is contained in:
parent
d59b3ad90a
commit
16a1f89929
|
@ -30,23 +30,18 @@ public static function driver($driver = null)
|
||||||
switch ($driver)
|
switch ($driver)
|
||||||
{
|
{
|
||||||
case 'file':
|
case 'file':
|
||||||
static::$drivers[$driver] = new Cache\File;
|
return static::$drivers[$driver] = new Cache\File;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'memcached':
|
case 'memcached':
|
||||||
static::$drivers[$driver] = new Cache\Memcached;
|
return static::$drivers[$driver] = new Cache\Memcached;
|
||||||
break;
|
|
||||||
|
|
||||||
case 'apc':
|
case 'apc':
|
||||||
static::$drivers[$driver] = new Cache\APC;
|
return static::$drivers[$driver] = new Cache\APC;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new \Exception("Cache driver [$driver] is not supported.");
|
throw new \Exception("Cache driver [$driver] is not supported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return static::$drivers[$driver];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue