public function Redis_Client_Predis::getClient in Redis 7
Same name and namespace in other branches
- 7.3 lib/Redis/Client/Predis.php \Redis_Client_Predis::getClient()
- 7.2 lib/Redis/Client/Predis.php \Redis_Client_Predis::getClient()
Get the connected client instance.
Return value
mixed Real client depends from the library behind.
Overrides Redis_Client_Interface::getClient
File
- lib/
Redis/ Client/ Predis.php, line 38
Class
- Redis_Client_Predis
- Predis client specific implementation.
Code
public function getClient($host = NULL, $port = NULL, $base = NULL) {
$connectionInfo = array(
'host' => $host,
'port' => $port,
'database' => $base,
);
foreach ($connectionInfo as $key => $value) {
if (!isset($value)) {
unset($connectionInfo[$key]);
}
}
return new Predis\Client($connectionInfo);
}