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