Package io.lettuce.core.cluster
Class ClusterClientOptions
- java.lang.Object
-
- io.lettuce.core.ClientOptions
-
- io.lettuce.core.cluster.ClusterClientOptions
-
- All Implemented Interfaces:
Serializable
public class ClusterClientOptions extends ClientOptions
Client Options to control the behavior ofRedisClusterClient
.- Author:
- Mark Paluch
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClusterClientOptions.Builder
Builder forClusterClientOptions
.-
Nested classes/interfaces inherited from class io.lettuce.core.ClientOptions
ClientOptions.DisconnectedBehavior
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_CLOSE_STALE_CONNECTIONS
static int
DEFAULT_MAX_REDIRECTS
static Predicate<RedisClusterNode>
DEFAULT_NODE_FILTER
static ReadOnlyCommands.ReadOnlyPredicate
DEFAULT_READ_ONLY_COMMANDS
static boolean
DEFAULT_REFRESH_CLUSTER_VIEW
static long
DEFAULT_REFRESH_PERIOD
static Duration
DEFAULT_REFRESH_PERIOD_DURATION
static boolean
DEFAULT_VALIDATE_CLUSTER_MEMBERSHIP
-
Fields inherited from class io.lettuce.core.ClientOptions
DEFAULT_AUTO_RECONNECT, DEFAULT_BUFFER_USAGE_RATIO, DEFAULT_CANCEL_CMD_RECONNECT_FAIL, DEFAULT_DISCONNECTED_BEHAVIOR, DEFAULT_PING_BEFORE_ACTIVATE_CONNECTION, DEFAULT_PROTOCOL_VERSION, DEFAULT_PUBLISH_ON_SCHEDULER, DEFAULT_REQUEST_QUEUE_SIZE, DEFAULT_SCRIPT_CHARSET, DEFAULT_SOCKET_OPTIONS, DEFAULT_SSL_OPTIONS, DEFAULT_SUSPEND_RECONNECT_PROTO_FAIL, DEFAULT_TIMEOUT_OPTIONS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClusterClientOptions(ClusterClientOptions original)
protected
ClusterClientOptions(ClusterClientOptions.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClusterClientOptions.Builder
builder()
Returns a newClusterClientOptions.Builder
to constructClusterClientOptions
.static ClusterClientOptions.Builder
builder(ClientOptions clientOptions)
Returns a newClusterClientOptions.Builder
initialized fromClientOptions
to constructClusterClientOptions
.static ClusterClientOptions
copyOf(ClusterClientOptions options)
Create a copy of options.static ClusterClientOptions
create()
Create a newClusterClientOptions
using default settings.int
getMaxRedirects()
Number of maximal of cluster redirects (-MOVED and -ASK) to follow in case a key was moved from one node to another node.Predicate<RedisClusterNode>
getNodeFilter()
Thenode filter
to filter Redis Cluster nodes fromPartitions
.Duration
getRefreshPeriod()
Period between the regular cluster topology updates.ClusterTopologyRefreshOptions
getTopologyRefreshOptions()
TheClusterTopologyRefreshOptions
for detailed control of topology updates.boolean
isCloseStaleConnections()
Flag, whether to close stale connections when refreshing the cluster topology.boolean
isRefreshClusterView()
Flag, whether regular cluster topology updates are updated.boolean
isValidateClusterNodeMembership()
Validate the cluster node membership before allowing connections to a cluster node.ClusterClientOptions.Builder
mutate()
Returns a builder to create newClusterClientOptions
whose settings are replicated from the currentClusterClientOptions
.-
Methods inherited from class io.lettuce.core.ClientOptions
copyOf, getBufferUsageRatio, getConfiguredProtocolVersion, getDecodeBufferPolicy, getDisconnectedBehavior, getProtocolVersion, getReadOnlyCommands, getRequestQueueSize, getScriptCharset, getSocketOptions, getSslOptions, getTimeoutOptions, isAutoReconnect, isCancelCommandsOnReconnectFailure, isPingBeforeActivateConnection, isPublishOnScheduler, isSuspendReconnectOnProtocolFailure
-
-
-
-
Field Detail
-
DEFAULT_CLOSE_STALE_CONNECTIONS
public static final boolean DEFAULT_CLOSE_STALE_CONNECTIONS
- See Also:
- Constant Field Values
-
DEFAULT_READ_ONLY_COMMANDS
public static final ReadOnlyCommands.ReadOnlyPredicate DEFAULT_READ_ONLY_COMMANDS
-
DEFAULT_MAX_REDIRECTS
public static final int DEFAULT_MAX_REDIRECTS
- See Also:
- Constant Field Values
-
DEFAULT_REFRESH_CLUSTER_VIEW
public static final boolean DEFAULT_REFRESH_CLUSTER_VIEW
- See Also:
- Constant Field Values
-
DEFAULT_REFRESH_PERIOD
public static final long DEFAULT_REFRESH_PERIOD
- See Also:
- Constant Field Values
-
DEFAULT_REFRESH_PERIOD_DURATION
public static final Duration DEFAULT_REFRESH_PERIOD_DURATION
-
DEFAULT_VALIDATE_CLUSTER_MEMBERSHIP
public static final boolean DEFAULT_VALIDATE_CLUSTER_MEMBERSHIP
- See Also:
- Constant Field Values
-
DEFAULT_NODE_FILTER
public static final Predicate<RedisClusterNode> DEFAULT_NODE_FILTER
-
-
Constructor Detail
-
ClusterClientOptions
protected ClusterClientOptions(ClusterClientOptions.Builder builder)
-
ClusterClientOptions
protected ClusterClientOptions(ClusterClientOptions original)
-
-
Method Detail
-
copyOf
public static ClusterClientOptions copyOf(ClusterClientOptions options)
Create a copy of options.- Parameters:
options
- the original- Returns:
- A new instance of
ClusterClientOptions
containing the values of options
-
builder
public static ClusterClientOptions.Builder builder()
Returns a newClusterClientOptions.Builder
to constructClusterClientOptions
.- Returns:
- a new
ClusterClientOptions.Builder
to constructClusterClientOptions
.
-
builder
public static ClusterClientOptions.Builder builder(ClientOptions clientOptions)
Returns a newClusterClientOptions.Builder
initialized fromClientOptions
to constructClusterClientOptions
.- Returns:
- a new
ClusterClientOptions.Builder
to constructClusterClientOptions
. - Since:
- 5.1.6
-
create
public static ClusterClientOptions create()
Create a newClusterClientOptions
using default settings.- Returns:
- a new instance of default cluster client options.
-
mutate
public ClusterClientOptions.Builder mutate()
Returns a builder to create newClusterClientOptions
whose settings are replicated from the currentClusterClientOptions
.- Overrides:
mutate
in classClientOptions
- Returns:
- a
ClusterClientOptions.Builder
to create newClusterClientOptions
whose settings are replicated from the currentClusterClientOptions
. - Since:
- 5.1
-
isCloseStaleConnections
public boolean isCloseStaleConnections()
Flag, whether to close stale connections when refreshing the cluster topology. Defaults totrue
. Comes only into effect ifisRefreshClusterView()
istrue
. Returns the value fromClusterTopologyRefreshOptions
if provided.- Returns:
true
if stale connections are cleaned up after cluster topology updates
-
getMaxRedirects
public int getMaxRedirects()
Number of maximal of cluster redirects (-MOVED and -ASK) to follow in case a key was moved from one node to another node. Defaults to 5. SeeDEFAULT_MAX_REDIRECTS
.- Returns:
- the maximal number of followed cluster redirects
-
isRefreshClusterView
public boolean isRefreshClusterView()
Flag, whether regular cluster topology updates are updated. The client starts updating the cluster topology in the intervals ofgetRefreshPeriod()
. Defaults tofalse
. Returns the value fromClusterTopologyRefreshOptions
if provided.- Returns:
true
it the cluster topology view is updated periodically
-
getRefreshPeriod
public Duration getRefreshPeriod()
Period between the regular cluster topology updates. Defaults to 60. Returns the value fromClusterTopologyRefreshOptions
if provided.- Returns:
- the period between the regular cluster topology updates
-
getTopologyRefreshOptions
public ClusterTopologyRefreshOptions getTopologyRefreshOptions()
TheClusterTopologyRefreshOptions
for detailed control of topology updates.- Returns:
- the
ClusterTopologyRefreshOptions
.
-
isValidateClusterNodeMembership
public boolean isValidateClusterNodeMembership()
Validate the cluster node membership before allowing connections to a cluster node. Defaults totrue
.- Returns:
true
if validation is enabled.
-
getNodeFilter
public Predicate<RedisClusterNode> getNodeFilter()
Thenode filter
to filter Redis Cluster nodes fromPartitions
.- Returns:
- the
node filter
to filter Redis Cluster nodes fromPartitions
. - Since:
- 6.1.6
-
-