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