Credis_Cluster::__call PHP Method

__call() public method

Execute a Redis command on the cluster with automatic consistent hashing and read/write splitting
public __call ( string $name, array $args ) : mixed
$name string
$args array
return mixed
    public function __call($name, $args)
    {
        if ($this->masterClient !== null && !$this->isReadOnlyCommand($name)) {
            $client = $this->masterClient;
        } elseif (count($this->clients()) == 1 || isset($this->dont_hash[strtoupper($name)]) || !isset($args[0])) {
            $client = $this->clients[0];
        } else {
            $client = $this->byHash($args[0]);
        }
        // Ensure that current client is working on the same database as expected.
        if ($client->getSelectedDb() != $this->selectedDb) {
            $client->select($this->selectedDb);
        }
        return call_user_func_array([$client, $name], $args);
    }