Module lettuce.core

Class ClusterTopologyRefreshOptions

java.lang.Object
io.lettuce.core.cluster.ClusterTopologyRefreshOptions

public class ClusterTopologyRefreshOptions
extends Object
Options to control the Cluster topology refreshing of RedisClusterClient.
Since:
4.2
Author:
Mark Paluch
  • Field Details

    • DEFAULT_ADAPTIVE_REFRESH_TRIGGERS

      public static final Set<ClusterTopologyRefreshOptions.RefreshTrigger> DEFAULT_ADAPTIVE_REFRESH_TRIGGERS
    • DEFAULT_ADAPTIVE_REFRESH_TIMEOUT

      public static final long DEFAULT_ADAPTIVE_REFRESH_TIMEOUT
      See Also:
      Constant Field Values
    • DEFAULT_ADAPTIVE_REFRESH_TIMEOUT_UNIT

      public static final TimeUnit DEFAULT_ADAPTIVE_REFRESH_TIMEOUT_UNIT
    • DEFAULT_ADAPTIVE_REFRESH_TIMEOUT_DURATION

      public static final Duration DEFAULT_ADAPTIVE_REFRESH_TIMEOUT_DURATION
    • DEFAULT_CLOSE_STALE_CONNECTIONS

      public static final boolean DEFAULT_CLOSE_STALE_CONNECTIONS
      See Also:
      Constant Field Values
    • DEFAULT_DYNAMIC_REFRESH_SOURCES

      public static final boolean DEFAULT_DYNAMIC_REFRESH_SOURCES
      See Also:
      Constant Field Values
    • DEFAULT_PERIODIC_REFRESH_ENABLED

      public static final boolean DEFAULT_PERIODIC_REFRESH_ENABLED
      See Also:
      Constant Field Values
    • DEFAULT_REFRESH_PERIOD

      public static final long DEFAULT_REFRESH_PERIOD
      See Also:
      Constant Field Values
    • DEFAULT_REFRESH_PERIOD_UNIT

      public static final TimeUnit DEFAULT_REFRESH_PERIOD_UNIT
    • DEFAULT_REFRESH_PERIOD_DURATION

      public static final Duration DEFAULT_REFRESH_PERIOD_DURATION
    • DEFAULT_REFRESH_TRIGGERS_RECONNECT_ATTEMPTS

      public static final int DEFAULT_REFRESH_TRIGGERS_RECONNECT_ATTEMPTS
      See Also:
      Constant Field Values
  • Constructor Details

  • Method Details

    • copyOf

      Create a copy of options.
      Parameters:
      options - the original
      Returns:
      A new instance of ClusterTopologyRefreshOptions containing the values of options
    • builder

      public static ClusterTopologyRefreshOptions.Builder builder()
      Returns:
      a new ClusterTopologyRefreshOptions.Builder to construct ClusterTopologyRefreshOptions.
    • create

      public static ClusterTopologyRefreshOptions create()
      Create a new ClusterTopologyRefreshOptions using default settings.
      Returns:
      a new instance of default cluster client client options.
    • enabled

      public static ClusterTopologyRefreshOptions enabled()
      Create a new ClusterTopologyRefreshOptions using default settings with enabled periodic and adaptive refresh.
      Returns:
      a new instance of default cluster client client options.
    • getAdaptiveRefreshTriggers

      public Set<ClusterTopologyRefreshOptions.RefreshTrigger> getAdaptiveRefreshTriggers()
      Returns the set of triggers. Adaptive refresh triggers initiate topology view updates based on events happened during Redis Cluster operations. Adaptive triggers lead to an immediate topology refresh. Adaptive triggered refreshes are rate-limited using a timeout since events can happen on a large scale. Adaptive refresh triggers are disabled by default.
      Returns:
      the set of triggers
    • getAdaptiveRefreshTimeout

      public Duration getAdaptiveRefreshTimeout()
      Timeout between adaptive cluster topology updates. Defaults to 30.
      Returns:
      the period between the regular cluster topology updates
    • isCloseStaleConnections

      public boolean isCloseStaleConnections()
      Flag, whether to close stale connections when refreshing the cluster topology. Defaults to true. Comes only into effect if isPeriodicRefreshEnabled() is true.
      Returns:
      true if stale connections are cleaned up after cluster topology updates
    • useDynamicRefreshSources

      public boolean useDynamicRefreshSources()
      Discover cluster nodes from topology and use the discovered nodes as source for the cluster topology. Using dynamic refresh will query all discovered nodes for the cluster topology and calculate the number of clients for each node.If set to false, only the initial seed nodes will be used as sources for topology discovery and the number of clients will be obtained only for the initial seed nodes. This can be useful when using Redis Cluster with many nodes.
      Returns:
      true if dynamic refresh sources are enabled
    • isPeriodicRefreshEnabled

      public boolean isPeriodicRefreshEnabled()
      Flag, whether regular cluster topology updates are updated. The client starts updating the cluster topology in the intervals of getRefreshPeriod(). Defaults to false.
      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 period between the regular cluster topology updates
    • getRefreshTriggersReconnectAttempts

      public int getRefreshTriggersReconnectAttempts()
      Threshold for ClusterTopologyRefreshOptions.RefreshTrigger.PERSISTENT_RECONNECTS. Topology updates based on persistent reconnects lead only to a refresh if the reconnect process tries at least refreshTriggersReconnectAttempts. See DEFAULT_REFRESH_TRIGGERS_RECONNECT_ATTEMPTS.
      Returns:
      umber of reconnect attempts for a connection before a n adaptive topology refresh is triggered