Predis\Connection\Replication\SentinelReplication::getConnectionByCommand PHP Метод

getConnectionByCommand() публичный Метод

public getConnectionByCommand ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface
    public function getConnectionByCommand(CommandInterface $command)
    {
        $connection = $this->getConnectionInternal($command);
        if (!$connection->isConnected()) {
            // When we do not have any available slave in the pool we can expect
            // read-only operations to hit the master server.
            $expectedRole = $this->strategy->isReadOperation($command) && $this->slaves ? 'slave' : 'master';
            $this->assertConnectionRole($connection, $expectedRole);
        }
        return $connection;
    }