Memcache caching, #18

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@120 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2010-03-05 18:41:02 +00:00
parent 00259cfe93
commit 2d7f5391f8
6 changed files with 287 additions and 21 deletions

View File

@ -32,18 +32,14 @@ class Db
*
* @return DbDriver
*/
static public function connect($name = null, $config = null)
static public function connect($name = 'default', $config = null)
{
if ($name === null) {
$name = 'default';
}
if (! isset(self::$connections[$name])) {
if (!isset(self::$connections[$name])) {
if (!$config) {
$config = Config::get('databases')->$name;
$config = Config::get(__CLASS__)->$name;
}
if (! is_array($config)) {
if (!is_array($config)) {
throw new Exception('Connection parameters must be an array');
}
@ -55,7 +51,7 @@ class Db
$connection = new $driver($config);
if (! $connection instanceof DbDriver) {
if (!$connection instanceof DbDriver) {
throw new Exception('Database driver must extends DbDriver');
}
self::$connections[$name] = $connection;