throw new InvalidArgumentException('Redis connection failed: '.
$redis->
getLastError());
} return $redis;
} /**
* @param string|string[]|null $auth
*/
private static function initializeRedisCluster(?\RedisCluster
$redis, array
$hosts, string|array|null
$auth, array
$params): \RedisCluster
{ $redis ??=
new \
RedisCluster(null,
$hosts,
$params['timeout'
],
$params['read_timeout'
],
(bool) ($params['persistent'
] ?? false
),
$auth, ...\
defined('Redis::SCAN_PREFIX'
) ?
[$params['ssl'
] ?? null
] :
[]);
$redis->
setOption(\Redis::OPT_SERIALIZER,
$params['serializer'
]);
return $redis;
} public static function fromDsn(#[\SensitiveParameter] string $dsn, array $options = [], \Redis|Relay|\RedisCluster $redis = null): self
{ if (!
str_contains($dsn, ','
)) { $parsedUrl = self::
parseDsn($dsn,
$options);
if (isset($parsedUrl['host'
]) && 'rediss' ===
$parsedUrl['scheme'
]) {