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 Summary
Constructors Constructor Description ConnectionState() -
Method Summary
Modifier and Type Method Description voidapply(RedisURI redisURI)Applies settings fromRedisURI.LonggetConnectionId()Returns the client connection id.StringgetMode()Returns the Redis server mode.ProtocolVersiongetNegotiatedProtocolVersion()Returns the negotiatedProtocolVersion.StringgetRedisVersion()Returns the Redis server version.StringgetRole()Returns the Redis server role.protected voidsetClientName(String clientName)protected voidsetDb(int db)protected voidsetPassword(char[] password)protected voidsetReadOnly(boolean readOnly)protected voidsetUsername(String username)protected voidsetUserNamePassword(List<char[]> args)Sets username/password state based on the argument count from anAUTHcommand.
-
Constructor Details
-
ConnectionState
public ConnectionState()
-
-
Method Details
-
apply
Applies settings fromRedisURI.- Parameters:
redisURI- the URI to apply the client name and authentication.
-
getNegotiatedProtocolVersion
Returns the negotiatedProtocolVersion.- Returns:
- the negotiated
ProtocolVersiononce the connection is established.
-
getConnectionId
Returns the client connection id. Only available when usingProtocolVersion.RESP3.- Returns:
- the client connection id. Can be
nullif Redis uses RESP2.
-
getRedisVersion
Returns the Redis server version. Only available when usingProtocolVersion.RESP3.- Returns:
- the Redis server version.
-
getMode
Returns the Redis server mode. Only available when usingProtocolVersion.RESP3.- Returns:
- the Redis server mode.
-
getRole
Returns the Redis server role. Only available when usingProtocolVersion.RESP3.- Returns:
- the Redis server role.
-
setUserNamePassword
Sets username/password state based on the argument count from anAUTHcommand.- Parameters:
args-
-
setUsername
-
setPassword
protected void setPassword(char[] password) -
setDb
protected void setDb(int db) -
setReadOnly
protected void setReadOnly(boolean readOnly) -
setClientName
-