$redisConfiguration['password']]; } foreach (['cluster', 'scheme', 'ssl'] as $key) { if (isset($redisConfiguration[$key])) { $redisOptions[$key] = $redisConfiguration[$key]; } } return $redisOptions; } /** * @param mixed[] $endpoints * @param mixed[] $inputOptions */ public static function createClient(array $endpoints, array $inputOptions): Client { $replication = $inputOptions['replication'] ?? null; if ('sentinel' === $replication) { $inputOptions['aggregate'] = fn () => fn ($sentinels, $options): SentinelReplication => new SentinelReplication( $options->service, $sentinels, $options->connections, new MasterOnlyStrategy(StrategyConfig::fromArray($inputOptions)) ); } $client = new Client($endpoints, $inputOptions); $profile = $client->getProfile(); \assert($profile instanceof RedisProfile); if (!$profile->getCommandClass(Unlink::ID)) { $profile->defineCommand(Unlink::ID, Unlink::class); } $connection = $client->getConnection(); if ($connection instanceof RedisCluster || $connection instanceof PredisCluster) { $clusterStrategy = $connection->getClusterStrategy(); if ($clusterStrategy instanceof ClusterStrategy && !in_array(Unlink::ID, $clusterStrategy->getSupportedCommands())) { $clusterStrategy->setCommandHandler(Unlink::ID, [$clusterStrategy, 'getKeyFromAllArguments']); } } return $client; } }