Predis\Connection\Aggregate\PredisCluster::writeRequest PHP Method

writeRequest() public method

public writeRequest ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface
    public function writeRequest(CommandInterface $command)
    {
        $this->getConnection($command)->writeRequest($command);
    }

Usage Example

 /**
  * @group disconnected
  */
 public function testWritesCommandToCorrectConnection()
 {
     $command = Profile\Factory::getDefault()->createCommand('get', array('node01:5431'));
     $connection1 = $this->getMockConnection('tcp://host1:7001');
     $connection1->expects($this->once())->method('writeRequest')->with($command);
     $connection2 = $this->getMockConnection('tcp://host1:7002');
     $connection2->expects($this->never())->method('writeRequest');
     $cluster = new PredisCluster();
     $cluster->add($connection1);
     $cluster->add($connection2);
     $cluster->writeRequest($command);
 }