public class RedisOptions extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ENDPOINT
The default redis endpoint =
redis://localhost:6379 |
Constructor and Description |
---|
RedisOptions()
Creates a default configuration object using redis server defaults
|
RedisOptions(JsonObject json)
Copy from JSON constructor.
|
RedisOptions(RedisOptions other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
RedisOptions |
addConnectionString(String connectionString)
Adds a connection string (endpoint) to use while connecting to the redis server.
|
RedisOptions |
addEndpoint(String connectionString)
Deprecated.
see
setConnectionString(String connectionString) for a better naming |
String |
getEndpoint()
Gets the redis endpoint to use
|
List<String> |
getEndpoints()
Gets the list of redis endpoints to use (mostly used while connecting to a cluster)
|
long |
getHashSlotCacheTTL()
Returns the TTL of the hash slot cache.
|
String |
getMasterName()
Get the master name (only considered in HA mode).
|
int |
getMaxNestedArrays()
Tune how much nested arrays are allowed on a redis response.
|
int |
getMaxPoolSize()
Tune the maximum size of the connection pool.
|
int |
getMaxPoolWaiting()
Tune the maximum waiting requests for a connection from the pool.
|
int |
getMaxWaitingHandlers()
The client will always work on pipeline mode, this means that messages can start queueing.
|
NetClientOptions |
getNetClientOptions()
Get the net client options used to connect to the server.
|
String |
getPassword()
Get the default password for cluster/sentinel connections, if not set it will try to
extract it from the current default endpoint.
|
int |
getPoolCleanerInterval()
Tune how often in milliseconds should the connection pool cleaner execute.
|
String |
getPoolName()
Get the pool name to be used in this client.
|
PoolOptions |
getPoolOptions() |
int |
getPoolRecycleTimeout()
Tune when a connection should be recycled in milliseconds.
|
RedisRole |
getRole()
Get the role name (only considered in HA mode).
|
TracingPolicy |
getTracingPolicy() |
RedisClientType |
getType()
Get the type of client to be created.
|
RedisReplicas |
getUseReplicas()
Get whether or not to use replica nodes (only considered in Cluster mode).
|
boolean |
isProtocolNegotiation()
Should the client perform
RESP protocol negotiation during the connection handshake. |
RedisOptions |
setConnectionString(String connectionString)
Sets a single connection string (endpoint) to use while connecting to the redis server.
|
RedisOptions |
setEndpoint(String connectionString)
Deprecated.
see
setConnectionString(String connectionString) for a better naming |
RedisOptions |
setEndpoints(List<String> endpoints)
Set the endpoints to use while connecting to the redis server.
|
RedisOptions |
setHashSlotCacheTTL(long hashSlotCacheTTL)
Sets the TTL of the hash slot cache.
|
RedisOptions |
setMasterName(String masterName)
Set the master name (only considered in HA mode).
|
RedisOptions |
setMaxNestedArrays(int maxNestedArrays)
Tune how much nested arrays are allowed on a redis response.
|
RedisOptions |
setMaxPoolSize(int maxPoolSize)
Tune the maximum size of the connection pool.
|
RedisOptions |
setMaxPoolWaiting(int maxPoolWaiting)
Tune the maximum waiting requests for a connection from the pool.
|
RedisOptions |
setMaxWaitingHandlers(int maxWaitingHandlers)
The client will always work on pipeline mode, this means that messages can start queueing.
|
RedisOptions |
setNetClientOptions(NetClientOptions netClientOptions)
Set the net client options to be used while connecting to the redis server.
|
RedisOptions |
setPassword(String password)
Set the default password for cluster/sentinel connections.
|
RedisOptions |
setPoolCleanerInterval(int poolCleanerInterval)
Tune how often in milliseconds should the connection pool cleaner execute.
|
RedisOptions |
setPoolName(String poolName)
Set a user defined pool name (for metrics reporting).
|
RedisOptions |
setPoolRecycleTimeout(int poolRecycleTimeout)
Tune when a connection should be recycled in milliseconds.
|
RedisOptions |
setProtocolNegotiation(boolean protocolNegotiation)
Should the client perform
REST protocol negotiation during the connection acquire. |
RedisOptions |
setRole(RedisRole role)
Set the role name (only considered in HA mode).
|
RedisOptions |
setTracingPolicy(TracingPolicy tracingPolicy)
Set the tracing policy for the client behavior when Vert.x has tracing enabled.
|
RedisOptions |
setType(RedisClientType type)
Set the desired client type to be created.
|
RedisOptions |
setUseReplicas(RedisReplicas useReplicas)
Set whether or not to use replica nodes (only considered in Cluster mode).
|
JsonObject |
toJson()
Converts this object to JSON notation.
|
public static final String DEFAULT_ENDPOINT
redis://localhost:6379
public RedisOptions()
public RedisOptions(RedisOptions other)
other
- the object to clone.public RedisOptions(JsonObject json)
json
- source jsonpublic RedisClientType getType()
public RedisOptions setType(RedisClientType type)
type
- the client type.public NetClientOptions getNetClientOptions()
public RedisOptions setNetClientOptions(NetClientOptions netClientOptions)
netClientOptions
- custom net client options.public List<String> getEndpoints()
public String getEndpoint()
public RedisOptions setEndpoints(List<String> endpoints)
endpoints
- list of socket addresses.@Deprecated public RedisOptions addEndpoint(String connectionString)
setConnectionString(String connectionString)
for a better namingconnectionString
- a string URI following the scheme: redis://[username:password@][host][:port][/database]@Deprecated public RedisOptions setEndpoint(String connectionString)
setConnectionString(String connectionString)
for a better namingconnectionString
- a string following the scheme: redis://[username:password@][host][:port][/[database]public RedisOptions addConnectionString(String connectionString)
connectionString
- a string URI following the scheme: redis://[username:password@][host][:port][/database]public RedisOptions setConnectionString(String connectionString)
connectionString
- a string following the scheme: redis://[username:password@][host][:port][/[database].public int getMaxWaitingHandlers()
public RedisOptions setMaxWaitingHandlers(int maxWaitingHandlers)
maxWaitingHandlers
- max allowed queued waiting handlers.public String getMasterName()
public RedisOptions setMasterName(String masterName)
masterName
- the master name.public RedisRole getRole()
public RedisOptions setRole(RedisRole role)
role
- the master name.public RedisReplicas getUseReplicas()
public RedisOptions setUseReplicas(RedisReplicas useReplicas)
useReplicas
- the cluster replica use mode.public int getMaxNestedArrays()
public RedisOptions setMaxNestedArrays(int maxNestedArrays)
maxNestedArrays
- the configured max nested arrays allowance.public TracingPolicy getTracingPolicy()
public RedisOptions setTracingPolicy(TracingPolicy tracingPolicy)
tracingPolicy
- the tracing policypublic PoolOptions getPoolOptions()
public int getPoolCleanerInterval()
public RedisOptions setPoolCleanerInterval(int poolCleanerInterval)
poolCleanerInterval
- the interval in milliseconds (-1 for never)public int getMaxPoolSize()
public RedisOptions setMaxPoolSize(int maxPoolSize)
maxPoolSize
- the max pool size.public int getMaxPoolWaiting()
public RedisOptions setMaxPoolWaiting(int maxPoolWaiting)
maxPoolWaiting
- max waiting requestspublic int getPoolRecycleTimeout()
public RedisOptions setPoolRecycleTimeout(int poolRecycleTimeout)
poolRecycleTimeout
- the timeout for recycling.public String getPassword()
public RedisOptions setPassword(String password)
password
- the default passwordpublic boolean isProtocolNegotiation()
RESP
protocol negotiation during the connection handshake.
By default this is true
, but there are situations when using broken servers it may
be useful to skip this and always fallback to RESP2
without using the HELLO
command.public RedisOptions setProtocolNegotiation(boolean protocolNegotiation)
REST
protocol negotiation during the connection acquire.
By default this is true
, but there are situations when using broken servers it may
be useful to skip this and always fallback to RESP2
without using the HELLO
command.protocolNegotiation
- false to disable HELLO
(not recommended) unless reasons...public RedisOptions setPoolName(String poolName)
poolName
- the user desired pool name.public String getPoolName()
public long getHashSlotCacheTTL()
The TTL is expressed in milliseconds. Defaults to 1000 millis (1 second).
public RedisOptions setHashSlotCacheTTL(long hashSlotCacheTTL)
The TTL is expressed in milliseconds. Defaults to 1000 millis (1 second).
hashSlotCacheTTL
- the TTL of the hash slot cache, in millispublic JsonObject toJson()
Copyright © 2024 Eclipse. All rights reserved.