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 of
RedisClusterClient.- Author:
- Mark Paluch
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClusterClientOptions.BuilderBuilder forClusterClientOptions.Nested classes/interfaces inherited from class io.lettuce.core.ClientOptions
ClientOptions.DisconnectedBehavior -
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_CLOSE_STALE_CONNECTIONSstatic intDEFAULT_MAX_REDIRECTSstatic booleanDEFAULT_REFRESH_CLUSTER_VIEWstatic longDEFAULT_REFRESH_PERIODstatic DurationDEFAULT_REFRESH_PERIOD_DURATIONstatic booleanDEFAULT_VALIDATE_CLUSTER_MEMBERSHIPFields 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 protectedClusterClientOptions(ClusterClientOptions original)protectedClusterClientOptions(ClusterClientOptions.Builder builder) -
Method Summary
Modifier and Type Method Description static ClusterClientOptions.Builderbuilder()Returns a newClusterClientOptions.Builderto constructClusterClientOptions.static ClusterClientOptions.Builderbuilder(ClientOptions clientOptions)Returns a newClusterClientOptions.Builderinitialized fromClientOptionsto constructClusterClientOptions.static ClusterClientOptionscopyOf(ClusterClientOptions options)Create a copy of options.static ClusterClientOptionscreate()Create a newClusterClientOptionsusing default settings.intgetMaxRedirects()Number of maximal of cluster redirects (-MOVED and -ASK) to follow in case a key was moved from one node to another node.DurationgetRefreshPeriod()Period between the regular cluster topology updates.ClusterTopologyRefreshOptionsgetTopologyRefreshOptions()TheClusterTopologyRefreshOptionsfor detailed control of topology updates.booleanisCloseStaleConnections()Flag, whether to close stale connections when refreshing the cluster topology.booleanisRefreshClusterView()Flag, whether regular cluster topology updates are updated.booleanisValidateClusterNodeMembership()Validate the cluster node membership before allowing connections to a cluster node.ClusterClientOptions.Buildermutate()Returns a builder to create newClusterClientOptionswhose settings are replicated from the currentClusterClientOptions.Methods inherited from class io.lettuce.core.ClientOptions
copyOf, getBufferUsageRatio, getConfiguredProtocolVersion, getDecodeBufferPolicy, getDisconnectedBehavior, getProtocolVersion, getRequestQueueSize, getScriptCharset, getSocketOptions, getSslOptions, getTimeoutOptions, isAutoReconnect, isCancelCommandsOnReconnectFailure, isPingBeforeActivateConnection, isPublishOnScheduler, isSuspendReconnectOnProtocolFailure
-
Field Details
-
DEFAULT_CLOSE_STALE_CONNECTIONS
public static final boolean DEFAULT_CLOSE_STALE_CONNECTIONS- See Also:
- Constant Field Values
-
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
-
DEFAULT_VALIDATE_CLUSTER_MEMBERSHIP
public static final boolean DEFAULT_VALIDATE_CLUSTER_MEMBERSHIP- See Also:
- Constant Field Values
-
-
Constructor Details
-
ClusterClientOptions
-
ClusterClientOptions
-
-
Method Details
-
copyOf
Create a copy of options.- Parameters:
options- the original- Returns:
- A new instance of
ClusterClientOptionscontaining the values of options
-
builder
Returns a newClusterClientOptions.Builderto constructClusterClientOptions.- Returns:
- a new
ClusterClientOptions.Builderto constructClusterClientOptions.
-
builder
Returns a newClusterClientOptions.Builderinitialized fromClientOptionsto constructClusterClientOptions.- Returns:
- a new
ClusterClientOptions.Builderto constructClusterClientOptions. - Since:
- 5.1.6
-
create
Create a newClusterClientOptionsusing default settings.- Returns:
- a new instance of default cluster client client options.
-
mutate
Returns a builder to create newClusterClientOptionswhose settings are replicated from the currentClusterClientOptions.- Overrides:
mutatein classClientOptions- Returns:
- a
ClusterClientOptions.Builderto create newClusterClientOptionswhose 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 fromClusterTopologyRefreshOptionsif provided.- Returns:
trueif 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 fromClusterTopologyRefreshOptionsif provided.- Returns:
trueit the cluster topology view is updated periodically
-
getRefreshPeriod
Period between the regular cluster topology updates. Defaults to 60. Returns the value fromClusterTopologyRefreshOptionsif provided.- Returns:
- the period between the regular cluster topology updates
-
getTopologyRefreshOptions
TheClusterTopologyRefreshOptionsfor 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:
trueif validation is enabled.
-