$server = $serverconf[0];
$port = $serverconf[1];
}
- if ($redis->connect($server, $port)) {
- if (!empty($password)) {
- $redis->auth($password);
- }
- // If using compressor, serialisation will be done at cachestore level, not php-redis.
- if ($this->compressor == self::COMPRESSOR_NONE) {
- $redis->setOption(Redis::OPT_SERIALIZER, $this->serializer);
- }
- if (!empty($prefix)) {
- $redis->setOption(Redis::OPT_PREFIX, $prefix);
+
+ try {
+ if ($redis->connect($server, $port)) {
+ if (!empty($password)) {
+ $redis->auth($password);
+ }
+ // If using compressor, serialisation will be done at cachestore level, not php-redis.
+ if ($this->compressor == self::COMPRESSOR_NONE) {
+ $redis->setOption(Redis::OPT_SERIALIZER, $this->serializer);
+ }
+ if (!empty($prefix)) {
+ $redis->setOption(Redis::OPT_PREFIX, $prefix);
+ }
+ // Database setting option...
+ $this->isready = $this->ping($redis);
+ } else {
+ $this->isready = false;
}
- // Database setting option...
- $this->isready = $this->ping($redis);
- } else {
+ } catch (\RedisException $e) {
$this->isready = false;
}
+
return $redis;
}