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