code: public function open()
      {
          if ($this->_socket !== false) {
              return;
          }
          $connection = ($this->unixSocket ?: $this->hostname . ':' . $this->port) . ', database=' . $this->database;
          \Yii::trace('Opening redis DB connection: ' . $connection, __METHOD__);
          $this->_socket = @stream_socket_client(
              $this->unixSocket ? 'unix://' . $this->unixSocket : 'tcp://' . $this->hostname . ':' . $this->port,
              $errorNumber,
              $errorDescription,
              $this->connectionTimeout ? $this->connectionTimeout : ini_get('default_socket_timeout'),
              $this->socketClientFlags
          );
          if ($this->_socket) {
              if ($this->dataTimeout !== null) {
                  stream_set_timeout($this->_socket, $timeout = (int) $this->dataTimeout, (int) (($this->dataTimeout - $timeout) * 1000000));
              }
              if ($this->password !== null) {
                  $this->executeCommand('AUTH', [$this->password]);
              }
              if ($this->database !== null) {
                  $this->executeCommand('SELECT', [$this->database]);
              }
              $this->initConnection();
          } else {
              \Yii::error("Failed to open redis DB connection ($connection): $errorNumber - $errorDescription", __CLASS__);
              $message = YII_DEBUG ? "Failed to open redis DB connection ($connection): $errorNumber - $errorDescription" : 'Failed to open DB connection.';
              throw new Exception($message, $errorDescription, $errorNumber);
          }
      }
docs: Establishes a DB connection.
  It does nothing if a DB connection has already been established.
  @throws Exception if connection fails