|
@@ 165-168 (lines=4) @@
|
| 162 |
|
* @return \Redis |
| 163 |
|
*/ |
| 164 |
|
private function setupRedisInstance() { |
| 165 |
|
if (!extension_loaded('redis')) { |
| 166 |
|
$this->logger->debug( |
| 167 |
|
'It seems that the message queueing capabilities are not available in your local php installation. Please install php-redis.'); |
| 168 |
|
throw new NotFoundException($this->l10n->t('Message queueing capabilities are missing on the server.')); |
| 169 |
|
} |
| 170 |
|
$redis = new \Redis(); |
| 171 |
|
if (!$redis->connect($this->redisHost, $this->redisPort, 2.5, NULL, 100)) { |
|
@@ 175-178 (lines=4) @@
|
| 172 |
|
$this->logger->debug('Cannot connect to Redis.'); |
| 173 |
|
throw new NotFoundException($this->l10n->t('Cannot connect to Redis.')); |
| 174 |
|
} |
| 175 |
|
if (!$redis->select($this->redisDb)) { |
| 176 |
|
$this->logger->debug('Cannot connect to the right Redis database.'); |
| 177 |
|
throw new NotFoundException($this->l10n->t('Cannot connect to the right Redis database.')); |
| 178 |
|
} |
| 179 |
|
$redis->setOption(\Redis::OPT_PREFIX, OcrConstants::REDIS_KEY_PREFIX); |
| 180 |
|
return $redis; |
| 181 |
|
} |