public static class ClientOptions.Builder extends Object
ClientOptions.| Modifier | Constructor and Description |
|---|---|
protected |
Builder() |
| Modifier and Type | Method and Description |
|---|---|
ClientOptions.Builder |
autoReconnect(boolean autoReconnect)
Enables or disables auto reconnection on connection loss.
|
ClientOptions.Builder |
bufferUsageRatio(int bufferUsageRatio)
Deprecated.
since 6.0 in favor of
DecodeBufferPolicy. |
ClientOptions |
build()
Create a new instance of
ClientOptions. |
ClientOptions.Builder |
cancelCommandsOnReconnectFailure(boolean cancelCommandsOnReconnectFailure)
Allows cancelling queued commands in case a reconnect fails.Defaults to
false. |
ClientOptions.Builder |
decodeBufferPolicy(DecodeBufferPolicy policy)
Set the policy to discard read bytes from the decoding aggregation buffer to reclaim memory.
|
ClientOptions.Builder |
disconnectedBehavior(ClientOptions.DisconnectedBehavior disconnectedBehavior)
Sets the behavior for command invocation when connections are in a disconnected state.
|
ClientOptions.Builder |
pingBeforeActivateConnection(boolean pingBeforeActivateConnection)
Sets the PING before activate connection flag.
|
ClientOptions.Builder |
protocolVersion(ProtocolVersion protocolVersion)
Sets the
ProtocolVersion to use. |
ClientOptions.Builder |
publishOnScheduler(boolean publishOnScheduler)
Use a dedicated
Scheduler to emit reactive data signals. |
ClientOptions.Builder |
requestQueueSize(int requestQueueSize)
Set the per-connection request queue size.
|
ClientOptions.Builder |
scriptCharset(Charset scriptCharset)
|
ClientOptions.Builder |
socketOptions(SocketOptions socketOptions)
Sets the low-level
SocketOptions for the connections kept to Redis servers. |
ClientOptions.Builder |
sslOptions(SslOptions sslOptions)
Sets the
SslOptions for SSL connections kept to Redis servers. |
ClientOptions.Builder |
suspendReconnectOnProtocolFailure(boolean suspendReconnectOnProtocolFailure)
Suspends reconnect when reconnects run into protocol failures (SSL verification, PING before connect fails).
|
ClientOptions.Builder |
timeoutOptions(TimeoutOptions timeoutOptions)
Sets the
TimeoutOptions to expire and cancel commands. |
public ClientOptions.Builder autoReconnect(boolean autoReconnect)
true. See
ClientOptions.DEFAULT_AUTO_RECONNECT.autoReconnect - true/falsethispublic ClientOptions.Builder cancelCommandsOnReconnectFailure(boolean cancelCommandsOnReconnectFailure)
false. See
ClientOptions.DEFAULT_CANCEL_CMD_RECONNECT_FAIL.cancelCommandsOnReconnectFailure - true/falsethis@Deprecated public ClientOptions.Builder bufferUsageRatio(int bufferUsageRatio)
DecodeBufferPolicy.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. See ClientOptions.DEFAULT_BUFFER_USAGE_RATIO.bufferUsageRatio - the buffer usage ratio. Must be between 0 and 2^31-1, typically a value
between 1 and 10 representing 50% to 90%.thispublic ClientOptions.Builder decodeBufferPolicy(DecodeBufferPolicy policy)
policy - the policy to use in CommandHandlerthisDecodeBufferPoliciespublic ClientOptions.Builder disconnectedBehavior(ClientOptions.DisconnectedBehavior disconnectedBehavior)
true. See
ClientOptions.DEFAULT_DISCONNECTED_BEHAVIOR.disconnectedBehavior - must not be null.thispublic ClientOptions.Builder pingBeforeActivateConnection(boolean pingBeforeActivateConnection)
true. See
ClientOptions.DEFAULT_PING_BEFORE_ACTIVATE_CONNECTION. This option has no effect unless forcing to use the RESP 2 protocol
version.pingBeforeActivateConnection - true/falsethispublic ClientOptions.Builder protocolVersion(ProtocolVersion protocolVersion)
ProtocolVersion to use. Defaults to RESP3. See ClientOptions.DEFAULT_PROTOCOL_VERSION.protocolVersion - version to use.thisProtocolVersion.newestSupported()public ClientOptions.Builder publishOnScheduler(boolean publishOnScheduler)
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 ClientOptions.DEFAULT_PUBLISH_ON_SCHEDULER.
publishOnScheduler - true/falsethisSubscriber.onNext(Object),
ClientResources.eventExecutorGroup()public ClientOptions.Builder requestQueueSize(int requestQueueSize)
RedisException if the queue
size is exceeded. Setting the requestQueueSize to a lower value will lead earlier to exceptions during
overload or while the connection is in a disconnected state. A higher value means hitting the boundary will take
longer to occur, but more requests will potentially be queued up and more heap space is used. Defaults to
Integer.MAX_VALUE. See ClientOptions.DEFAULT_REQUEST_QUEUE_SIZE.requestQueueSize - the queue size.thispublic ClientOptions.Builder scriptCharset(Charset scriptCharset)
Charset to use to encode scripts to byte[]. Defaults to
StandardCharsets.UTF_8. See ClientOptions.DEFAULT_SCRIPT_CHARSET.scriptCharset - must not be null.thispublic ClientOptions.Builder socketOptions(SocketOptions socketOptions)
SocketOptions for the connections kept to Redis servers. See
ClientOptions.DEFAULT_SOCKET_OPTIONS.socketOptions - must not be null.thispublic ClientOptions.Builder sslOptions(SslOptions sslOptions)
SslOptions for SSL connections kept to Redis servers. See ClientOptions.DEFAULT_SSL_OPTIONS.sslOptions - must not be null.thispublic ClientOptions.Builder suspendReconnectOnProtocolFailure(boolean suspendReconnectOnProtocolFailure)
false. See ClientOptions.DEFAULT_SUSPEND_RECONNECT_PROTO_FAIL.suspendReconnectOnProtocolFailure - true/falsethispublic ClientOptions.Builder timeoutOptions(TimeoutOptions timeoutOptions)
TimeoutOptions to expire and cancel commands. See ClientOptions.DEFAULT_TIMEOUT_OPTIONS.timeoutOptions - must not be null.thispublic ClientOptions build()
ClientOptions.ClientOptionsCopyright © 2021 lettuce.io. All rights reserved.