cache.php: add unix socket connection support to Redis cache

This commit is contained in:
Zankaria 2024-09-11 15:50:23 +02:00 committed by Zankaria
parent 696f084749
commit 87899a0988

View file

@ -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;
}
}