Executes the specified Redis command on all the nodes of a cluster.
public executeCommandOnNodes ( Predis\Command\CommandInterface $command ) : array | ||
$command | Predis\Command\CommandInterface | A Redis command. |
return | array |
/** * @group disconnected */ public function testExecuteCommandOnEachNode() { $ping = Profile\Factory::getDefault()->createCommand('ping', array()); $connection1 = $this->getMock('Predis\\Connection\\NodeConnectionInterface'); $connection1->expects($this->once())->method('executeCommand')->with($ping)->will($this->returnValue(true)); $connection2 = $this->getMock('Predis\\Connection\\NodeConnectionInterface'); $connection2->expects($this->once())->method('executeCommand')->with($ping)->will($this->returnValue(false)); $cluster = new PredisCluster(); $cluster->add($connection1); $cluster->add($connection2); $this->assertSame(array(true, false), $cluster->executeCommandOnNodes($ping)); }