Package io.vertx.redis.client
Class RedisClusterConnectOptions
- java.lang.Object
-
- io.vertx.redis.client.RedisConnectOptions
-
- io.vertx.redis.client.RedisClusterConnectOptions
-
public class RedisClusterConnectOptions extends RedisConnectOptions
-
-
Constructor Summary
Constructors Constructor Description RedisClusterConnectOptions()
RedisClusterConnectOptions(JsonObject json)
RedisClusterConnectOptions(RedisClusterConnectOptions other)
RedisClusterConnectOptions(RedisOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RedisClusterConnectOptions
addConnectionString(String connectionString)
Adds a connection string (endpoint) to use while connecting to the redis server.RedisClusterTransactions
getClusterTransactions()
Get how Redis transactions are handled in cluster mode.long
getHashSlotCacheTTL()
Returns the TTL of the hash slot cache.RedisReplicas
getUseReplicas()
Get whether to use replica nodes for read only queries.RedisClusterConnectOptions
setClusterTransactions(RedisClusterTransactions clusterTransactions)
Set how Redis transactions are handled in cluster mode.RedisClusterConnectOptions
setConnectionString(String connectionString)
Sets a single connection string (endpoint) to use while connecting to the redis server.RedisClusterConnectOptions
setEndpoints(List<String> endpoints)
Set the endpoints to use while connecting to the redis server.RedisClusterConnectOptions
setHashSlotCacheTTL(long hashSlotCacheTTL)
Sets the TTL of the hash slot cache.RedisClusterConnectOptions
setMaxNestedArrays(int maxNestedArrays)
Tune how much nested arrays are allowed on a redis response.RedisClusterConnectOptions
setMaxWaitingHandlers(int maxWaitingHandlers)
The client will always work on pipeline mode, this means that messages can start queueing.RedisClusterConnectOptions
setPassword(String password)
Set the default password for Redis connections.RedisClusterConnectOptions
setPreferredProtocolVersion(ProtocolVersion preferredProtocolVersion)
Sets the preferred protocol version to be used during protocol negotiation.RedisClusterConnectOptions
setProtocolNegotiation(boolean protocolNegotiation)
Should the client performREST
protocol negotiation during the connection acquire.RedisClusterConnectOptions
setUser(String user)
Set the default username for Redis connections.RedisClusterConnectOptions
setUseReplicas(RedisReplicas useReplicas)
Set whether to use replica nodes for read only queries.JsonObject
toJson()
Converts this object to JSON notation.-
Methods inherited from class io.vertx.redis.client.RedisConnectOptions
getEndpoint, getEndpoints, getMaxNestedArrays, getMaxWaitingHandlers, getPassword, getPreferredProtocolVersion, getUser, isProtocolNegotiation
-
-
-
-
Constructor Detail
-
RedisClusterConnectOptions
public RedisClusterConnectOptions()
-
RedisClusterConnectOptions
public RedisClusterConnectOptions(RedisOptions options)
-
RedisClusterConnectOptions
public RedisClusterConnectOptions(RedisClusterConnectOptions other)
-
RedisClusterConnectOptions
public RedisClusterConnectOptions(JsonObject json)
-
-
Method Detail
-
getUseReplicas
public RedisReplicas getUseReplicas()
Get whether to use replica nodes for read only queries.- Returns:
- the cluster replica node use mode.
-
setUseReplicas
public RedisClusterConnectOptions setUseReplicas(RedisReplicas useReplicas)
Set whether to use replica nodes for read only queries.- Parameters:
useReplicas
- the cluster replica use mode.- Returns:
- fluent self.
-
getHashSlotCacheTTL
public long getHashSlotCacheTTL()
Returns the TTL of the hash slot cache. The TTL is expressed in milliseconds. Defaults to 1000 millis (1 second).- Returns:
- the TTL of the hash slot cache
-
setHashSlotCacheTTL
public RedisClusterConnectOptions setHashSlotCacheTTL(long hashSlotCacheTTL)
Sets the TTL of the hash slot cache. The TTL is expressed in milliseconds. Defaults to 1000 millis (1 second).- Parameters:
hashSlotCacheTTL
- the TTL of the hash slot cache, in millis
-
getClusterTransactions
public RedisClusterTransactions getClusterTransactions()
Get how Redis transactions are handled in cluster mode.- Returns:
- how transactions are handled
-
setClusterTransactions
public RedisClusterConnectOptions setClusterTransactions(RedisClusterTransactions clusterTransactions)
Set how Redis transactions are handled in cluster mode.- Parameters:
clusterTransactions
- transaction handling mode- Returns:
- fluent self
-
setMaxNestedArrays
public RedisClusterConnectOptions setMaxNestedArrays(int maxNestedArrays)
Description copied from class:RedisConnectOptions
Tune how much nested arrays are allowed on a redis response. This affects the parser performance.- Overrides:
setMaxNestedArrays
in classRedisConnectOptions
- Parameters:
maxNestedArrays
- the configured max nested arrays allowance.- Returns:
- fluent self.
-
setProtocolNegotiation
public RedisClusterConnectOptions setProtocolNegotiation(boolean protocolNegotiation)
Description copied from class:RedisConnectOptions
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.- Overrides:
setProtocolNegotiation
in classRedisConnectOptions
- Parameters:
protocolNegotiation
- false to disableHELLO
(not recommended) unless reasons...- Returns:
- fluent self
-
setPreferredProtocolVersion
public RedisClusterConnectOptions setPreferredProtocolVersion(ProtocolVersion preferredProtocolVersion)
Description copied from class:RedisConnectOptions
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.- Overrides:
setPreferredProtocolVersion
in classRedisConnectOptions
- Parameters:
preferredProtocolVersion
- preferred protocol version- Returns:
- fluent self
-
setUser
public RedisClusterConnectOptions setUser(String user)
Description copied from class:RedisConnectOptions
Set the default username for Redis connections.- Overrides:
setUser
in classRedisConnectOptions
- Parameters:
user
- the default username- Returns:
- fluent self
-
setPassword
public RedisClusterConnectOptions setPassword(String password)
Description copied from class:RedisConnectOptions
Set the default password for Redis connections.- Overrides:
setPassword
in classRedisConnectOptions
- Parameters:
password
- the default password- Returns:
- fluent self
-
setEndpoints
public RedisClusterConnectOptions setEndpoints(List<String> endpoints)
Description copied from class:RedisConnectOptions
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.- Overrides:
setEndpoints
in classRedisConnectOptions
- Parameters:
endpoints
- list of socket addresses.- Returns:
- fluent self.
-
addConnectionString
public RedisClusterConnectOptions addConnectionString(String connectionString)
Description copied from class:RedisConnectOptions
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.- Overrides:
addConnectionString
in classRedisConnectOptions
- 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 RedisClusterConnectOptions setConnectionString(String connectionString)
Description copied from class:RedisConnectOptions
Sets a single connection string (endpoint) to use while connecting to the redis server. Will replace the previously configured connection strings.- Overrides:
setConnectionString
in classRedisConnectOptions
- Parameters:
connectionString
- a string following the scheme: redis://[username:password@][host][:port][/[database].- Returns:
- fluent self.
- See Also:
- Redis scheme on iana.org
-
setMaxWaitingHandlers
public RedisClusterConnectOptions setMaxWaitingHandlers(int maxWaitingHandlers)
Description copied from class:RedisConnectOptions
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.- Overrides:
setMaxWaitingHandlers
in classRedisConnectOptions
- Parameters:
maxWaitingHandlers
- max allowed queued waiting handlers.- Returns:
- fluent self.
-
toJson
public JsonObject toJson()
Converts this object to JSON notation.- Overrides:
toJson
in classRedisConnectOptions
- Returns:
- JSON
-
-