Module lettuce.core

Class ConnectionState

java.lang.Object
io.lettuce.core.ConnectionState

public class ConnectionState
extends Object
Internal connection state representing the negotiated ProtocolVersion and other options for connection initialization and connection state restoration. This class is part of the internal API.
Since:
6.0
Author:
Mark Paluch
  • Constructor Details

    • ConnectionState

      public ConnectionState()
  • Method Details

    • apply

      public void apply​(RedisURI redisURI)
      Applies settings from RedisURI.
      Parameters:
      redisURI - the URI to apply the client name and authentication.
    • getNegotiatedProtocolVersion

      public ProtocolVersion getNegotiatedProtocolVersion()
      Returns the negotiated ProtocolVersion.
      Returns:
      the negotiated ProtocolVersion once the connection is established.
    • getConnectionId

      public Long getConnectionId()
      Returns the client connection id. Only available when using ProtocolVersion.RESP3.
      Returns:
      the client connection id. Can be null if Redis uses RESP2.
    • getRedisVersion

      public String getRedisVersion()
      Returns the Redis server version. Only available when using ProtocolVersion.RESP3.
      Returns:
      the Redis server version.
    • getMode

      public String getMode()
      Returns the Redis server mode. Only available when using ProtocolVersion.RESP3.
      Returns:
      the Redis server mode.
    • getRole

      public String getRole()
      Returns the Redis server role. Only available when using ProtocolVersion.RESP3.
      Returns:
      the Redis server role.
    • setUserNamePassword

      protected void setUserNamePassword​(List<char[]> args)
      Sets username/password state based on the argument count from an AUTH command.
      Parameters:
      args -
    • setUsername

      protected void setUsername​(String username)
    • setPassword

      protected void setPassword​(char[] password)
    • setDb

      protected void setDb​(int db)
    • setReadOnly

      protected void setReadOnly​(boolean readOnly)
    • setClientName

      protected void setClientName​(String clientName)