Package io.vertx.redis.client
Class RedisConnectOptions
- java.lang.Object
-
- io.vertx.redis.client.RedisConnectOptions
-
- Direct Known Subclasses:
RedisClusterConnectOptions
,RedisReplicationConnectOptions
,RedisSentinelConnectOptions
,RedisStandaloneConnectOptions
public abstract class RedisConnectOptions extends Object
-
-
Constructor Summary
Constructors Constructor Description RedisConnectOptions()
RedisConnectOptions(JsonObject json)
RedisConnectOptions(RedisConnectOptions other)
RedisConnectOptions(RedisOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RedisConnectOptions
addConnectionString(String connectionString)
Adds a connection string (endpoint) to use while connecting to the redis server.String
getEndpoint()
Gets the redis endpoint to useList<String>
getEndpoints()
Gets the list of redis endpoints to use (mostly used while connecting to a cluster)int
getMaxNestedArrays()
Tune how much nested arrays are allowed on a redis response.int
getMaxWaitingHandlers()
The client will always work on pipeline mode, this means that messages can start queueing.String
getPassword()
Get the default password for Redis connections.ProtocolVersion
getPreferredProtocolVersion()
Returns the preferred protocol version to be used during protocol negotiation.String
getUser()
Get the default username for Redis connections.boolean
isProtocolNegotiation()
Should the client performRESP
protocol negotiation during the connection handshake.RedisConnectOptions
setConnectionString(String connectionString)
Sets a single connection string (endpoint) to use while connecting to the redis server.RedisConnectOptions
setEndpoints(List<String> endpoints)
Set the endpoints to use while connecting to the redis server.RedisConnectOptions
setMaxNestedArrays(int maxNestedArrays)
Tune how much nested arrays are allowed on a redis response.RedisConnectOptions
setMaxWaitingHandlers(int maxWaitingHandlers)
The client will always work on pipeline mode, this means that messages can start queueing.RedisConnectOptions
setPassword(String password)
Set the default password for Redis connections.RedisConnectOptions
setPreferredProtocolVersion(ProtocolVersion preferredProtocolVersion)
Sets the preferred protocol version to be used during protocol negotiation.RedisConnectOptions
setProtocolNegotiation(boolean protocolNegotiation)
Should the client performREST
protocol negotiation during the connection acquire.RedisConnectOptions
setUser(String user)
Set the default username for Redis connections.JsonObject
toJson()
Converts this object to JSON notation.
-
-
-
Constructor Detail
-
RedisConnectOptions
public RedisConnectOptions()
-
RedisConnectOptions
public RedisConnectOptions(RedisOptions options)
-
RedisConnectOptions
public RedisConnectOptions(RedisConnectOptions other)
-
RedisConnectOptions
public RedisConnectOptions(JsonObject json)
-
-
Method Detail
-
getMaxNestedArrays
public int getMaxNestedArrays()
Tune how much nested arrays are allowed on a redis response. This affects the parser performance.- Returns:
- the configured max nested arrays allowance.
-
setMaxNestedArrays
public RedisConnectOptions setMaxNestedArrays(int maxNestedArrays)
Tune how much nested arrays are allowed on a redis response. This affects the parser performance.- Parameters:
maxNestedArrays
- the configured max nested arrays allowance.- Returns:
- fluent self.
-
isProtocolNegotiation
public boolean isProtocolNegotiation()
Should the client performRESP
protocol negotiation during the connection handshake. By default this istrue
, but there are situations when using broken servers it may be useful to skip this and always fallback toRESP2
without using theHELLO
command.- Returns:
- true to perform negotiation.
-
setProtocolNegotiation
public RedisConnectOptions setProtocolNegotiation(boolean protocolNegotiation)
Should the client performREST
protocol negotiation during the connection acquire. By default this istrue
, but there are situations when using broken servers it may be useful to skip this and always fallback toRESP2
without using theHELLO
command.- Parameters:
protocolNegotiation
- false to disableHELLO
(not recommended) unless reasons...- Returns:
- fluent self
-
getPreferredProtocolVersion
public ProtocolVersion getPreferredProtocolVersion()
Returns the preferred protocol version to be used during protocol negotiation. When not set, defaults to RESP 3. When protocol negotiation is disabled, this setting has no effect.- Returns:
- preferred protocol version
-
setPreferredProtocolVersion
public RedisConnectOptions setPreferredProtocolVersion(ProtocolVersion preferredProtocolVersion)
Sets the preferred protocol version to be used during protocol negotiation. When not set, defaults to RESP 3. When protocol negotiation is disabled, this setting has no effect.- Parameters:
preferredProtocolVersion
- preferred protocol version- Returns:
- fluent self
-
getUser
public String getUser()
Get the default username for Redis connections.- Returns:
- username
-
setUser
public RedisConnectOptions setUser(String user)
Set the default username for Redis connections.- Parameters:
user
- the default username- Returns:
- fluent self
-
getPassword
public String getPassword()
Get the default password for Redis connections.- Returns:
- password
-
setPassword
public RedisConnectOptions setPassword(String password)
Set the default password for Redis connections.- Parameters:
password
- the default password- Returns:
- fluent self
-
getEndpoint
public String getEndpoint()
Gets the redis endpoint to use- Returns:
- the Redis connection string URI
-
addConnectionString
public RedisConnectOptions addConnectionString(String connectionString)
Adds a connection string (endpoint) to use while connecting to the redis server. Only the cluster mode will consider more than 1 element. If more are provided, they are not considered by the client when in single server mode.- Parameters:
connectionString
- a string URI following the scheme: redis://[username:password@][host][:port][/database]- Returns:
- fluent self.
- See Also:
- Redis scheme on iana.org
-
setConnectionString
public RedisConnectOptions setConnectionString(String connectionString)
Sets a single connection string (endpoint) to use while connecting to the redis server. Will replace the previously configured connection strings.- Parameters:
connectionString
- a string following the scheme: redis://[username:password@][host][:port][/[database].- Returns:
- fluent self.
- See Also:
- Redis scheme on iana.org
-
getEndpoints
public List<String> getEndpoints()
Gets the list of redis endpoints to use (mostly used while connecting to a cluster)- Returns:
- list of socket addresses.
-
setEndpoints
public RedisConnectOptions setEndpoints(List<String> endpoints)
Set the endpoints to use while connecting to the redis server. Only the cluster mode will consider more than 1 element. If more are provided, they are not considered by the client when in single server mode.- Parameters:
endpoints
- list of socket addresses.- Returns:
- fluent self.
-
getMaxWaitingHandlers
public int getMaxWaitingHandlers()
The client will always work on pipeline mode, this means that messages can start queueing. You can control how much backlog you're willing to accept. This methods returns how much handlers is the client willing to queue.- Returns:
- max allowed queued waiting handlers.
-
setMaxWaitingHandlers
public RedisConnectOptions setMaxWaitingHandlers(int maxWaitingHandlers)
The client will always work on pipeline mode, this means that messages can start queueing. You can control how much backlog you're willing to accept. This methods sets how much handlers is the client willing to queue.- Parameters:
maxWaitingHandlers
- max allowed queued waiting handlers.- Returns:
- fluent self.
-
toJson
public JsonObject toJson()
Converts this object to JSON notation.- Returns:
- JSON
-
-