Update -> refactor and optimize UI , code ,...
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
function redisClient()
|
||||
function redisClient(): Redis
|
||||
{
|
||||
static $redis = null;
|
||||
if ($redis === null) {
|
||||
$config = require __DIR__ . '/../config/config.php';
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->connect($config['redis']['host'], $config['redis']['port']);
|
||||
$redis = new Redis();
|
||||
if (!@$redis->connect($config['redis']['host'], $config['redis']['port'])) {
|
||||
throw new RuntimeException('Redis connection failed.');
|
||||
}
|
||||
}
|
||||
return $redis;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user