Class ClientOptions

    • Field Detail

      • DEFAULT_AUTO_RECONNECT

        public static final boolean DEFAULT_AUTO_RECONNECT
        See Also:
        Constant Field Values
      • DEFAULT_BUFFER_USAGE_RATIO

        public static final int DEFAULT_BUFFER_USAGE_RATIO
        See Also:
        Constant Field Values
      • DEFAULT_CANCEL_CMD_RECONNECT_FAIL

        public static final boolean DEFAULT_CANCEL_CMD_RECONNECT_FAIL
        See Also:
        Constant Field Values
      • DEFAULT_PUBLISH_ON_SCHEDULER

        public static final boolean DEFAULT_PUBLISH_ON_SCHEDULER
        See Also:
        Constant Field Values
      • DEFAULT_PING_BEFORE_ACTIVATE_CONNECTION

        public static final boolean DEFAULT_PING_BEFORE_ACTIVATE_CONNECTION
        See Also:
        Constant Field Values
      • DEFAULT_PROTOCOL_VERSION

        public static final ProtocolVersion DEFAULT_PROTOCOL_VERSION
      • DEFAULT_REQUEST_QUEUE_SIZE

        public static final int DEFAULT_REQUEST_QUEUE_SIZE
        See Also:
        Constant Field Values
      • DEFAULT_SCRIPT_CHARSET

        public static final Charset DEFAULT_SCRIPT_CHARSET
      • DEFAULT_SOCKET_OPTIONS

        public static final SocketOptions DEFAULT_SOCKET_OPTIONS
      • DEFAULT_SSL_OPTIONS

        public static final SslOptions DEFAULT_SSL_OPTIONS
      • DEFAULT_SUSPEND_RECONNECT_PROTO_FAIL

        public static final boolean DEFAULT_SUSPEND_RECONNECT_PROTO_FAIL
        See Also:
        Constant Field Values
      • DEFAULT_TIMEOUT_OPTIONS

        public static final TimeoutOptions DEFAULT_TIMEOUT_OPTIONS
    • Method Detail

      • copyOf

        public static ClientOptions copyOf​(ClientOptions options)
        Create a copy of options
        Parameters:
        options - the original
        Returns:
        A new instance of ClientOptions containing the values of options
      • isAutoReconnect

        public boolean isAutoReconnect()
        Controls auto-reconnect behavior on connections. If auto-reconnect is true (default), it is enabled. As soon as a connection gets closed/reset without the intention to close it, the client will try to reconnect and re-issue any queued commands. This flag has also the effect that disconnected connections will refuse commands and cancel these with an exception.
        Returns:
        true if auto-reconnect is enabled.
      • isCancelCommandsOnReconnectFailure

        @Deprecated
        public boolean isCancelCommandsOnReconnectFailure()
        Deprecated.
        If this flag is true any queued commands will be canceled when a reconnect fails within the activation sequence. Default is false.
        Returns:
        true if commands should be cancelled on reconnect failures.
      • getBufferUsageRatio

        @Deprecated
        public int getBufferUsageRatio()
        Deprecated.
        since 6.0 in favor of DecodeBufferPolicy.
        Buffer usage ratio for CommandHandler. This ratio controls how often bytes are discarded during decoding. In particular, when buffer usage reaches bufferUsageRatio / bufferUsageRatio + 1. E.g. setting bufferUsageRatio to 3, will discard read bytes once the buffer usage reaches 75 percent.
        Returns:
        zero.
        Since:
        5.2
      • getRequestQueueSize

        public int getRequestQueueSize()
        Request queue size for a connection. This value applies per connection. The command invocation will throw a RedisException if the queue size is exceeded and a new command is requested. Defaults to Integer.MAX_VALUE.
        Returns:
        the request queue size.
      • isPingBeforeActivateConnection

        public boolean isPingBeforeActivateConnection()
        Perform a lightweight PING connection handshake when establishing a Redis connection. If true (default is true), every connection and reconnect will issue a PING command and await its response before the connection is activated and enabled for use. If the check fails, the connect/reconnect is treated as a failure. This option has no effect unless forced to use the RESP 2 protocol version. RESP 3/protocol discovery performs a HELLO handshake.

        The PING handshake validates whether the other end of the connected socket is a service that behaves like a Redis server.

        Returns:
        true if PING handshake is enabled.
      • isPublishOnScheduler

        public boolean isPublishOnScheduler()
        Use a dedicated Scheduler to emit reactive data signals. Enabling this option can be useful for reactive sequences that require a significant amount of processing with a single/a few Redis connections.

        A single Redis connection operates on a single thread. Operations that require a significant amount of processing can lead to a single-threaded-like behavior for all consumers of the Redis connection. When enabled, data signals will be emitted using a different thread served by ClientResources.eventExecutorGroup(). Defaults to false , see DEFAULT_PUBLISH_ON_SCHEDULER.

        Returns:
        true to use a dedicated Scheduler
        Since:
        5.2
      • isSuspendReconnectOnProtocolFailure

        public boolean isSuspendReconnectOnProtocolFailure()
        If this flag is true, the reconnect will be suspended on protocol errors. Protocol errors are errors while SSL negotiation or when PING before connect fails.
        Returns:
        true if reconnect will be suspended on protocol errors.
      • getScriptCharset

        public Charset getScriptCharset()
        Returns the Lua script Charset.
        Returns:
        the script Charset.
        Since:
        6.0