Predis\Connection\Factory::prepareConnection PHP Method

prepareConnection() protected method

Prepares a connection instance after its initialization.
protected prepareConnection ( Predis\Connection\NodeConnectionInterface $connection )
$connection Predis\Connection\NodeConnectionInterface Connection instance.
    protected function prepareConnection(NodeConnectionInterface $connection)
    {
        $parameters = $connection->getParameters();
        if (isset($parameters->password)) {
            $connection->addConnectCommand(new RawCommand('AUTH', array($parameters->password)));
        }
        if (isset($parameters->database)) {
            $connection->addConnectCommand(new RawCommand('SELECT', array($parameters->database)));
        }
    }