Memcache\Redis Add DB Select Functionality

This commit is contained in:
Michael Telatynski 2015-04-14 20:40:31 +01:00
parent 2a68336952
commit 8ebf9de3f8
2 changed files with 8 additions and 2 deletions

View File

@ -831,7 +831,8 @@ $CONFIG = array(
'redis' => array(
'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock'
'port' => 6379,
'timeout' => 0.0
'timeout' => 0.0,
'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index.
),
/**

View File

@ -51,7 +51,12 @@ class Redis extends Cache {
} else {
$timeout = 0.0; // unlimited
}
self::$cache->connect( $host, $port, $timeout );
if (isset($config['dbindex'])) {
self::$cache->select( $config['dbindex'] );
}
}
}