forked from leftypol/leftypol
cache.php: add unix socket connection support to Redis cache
This commit is contained in:
parent
696f084749
commit
87899a0988
1 changed files with 24 additions and 16 deletions
|
@ -18,7 +18,16 @@ class Cache {
|
|||
break;
|
||||
case 'redis':
|
||||
self::$cache = new Redis();
|
||||
self::$cache->connect($config['cache']['redis'][0], $config['cache']['redis'][1]);
|
||||
|
||||
$ret = explode(':', $config['cache']['redis'][0]);
|
||||
if (count($ret) > 0) {
|
||||
// Unix socket.
|
||||
self::$cache->connect($ret[1]);
|
||||
} else {
|
||||
// IP + port.
|
||||
self::$cache->connect($ret[0], $config['cache']['redis'][1]);
|
||||
}
|
||||
|
||||
if ($config['cache']['redis'][2]) {
|
||||
self::$cache->auth($config['cache']['redis'][2]);
|
||||
}
|
||||
|
@ -174,4 +183,3 @@ class Cache {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue