java.lang.Object
io.lettuce.core.SocketOptions
public class SocketOptions extends Object
Options to configure low-level socket options for the connections kept to Redis servers.
- Since:
- 4.3
- Author:
- Mark Paluch
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSocketOptions.BuilderBuilder forSocketOptions.static classSocketOptions.KeepAliveOptionsExtended Keep-Alive options (idle, interval, count). -
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_CONNECT_TIMEOUTstatic DurationDEFAULT_CONNECT_TIMEOUT_DURATIONstatic TimeUnitDEFAULT_CONNECT_TIMEOUT_UNITstatic booleanDEFAULT_SO_KEEPALIVEstatic booleanDEFAULT_SO_NO_DELAY -
Constructor Summary
Constructors Modifier Constructor Description protectedSocketOptions(SocketOptions original)protectedSocketOptions(SocketOptions.Builder builder) -
Method Summary
Modifier and Type Method Description static SocketOptions.Builderbuilder()Returns a newSocketOptions.Builderto constructSocketOptions.static SocketOptionscopyOf(SocketOptions options)Create a copy of optionsstatic SocketOptionscreate()Create a newSocketOptionsusing default settings.DurationgetConnectTimeout()Returns the connection timeout.SocketOptions.KeepAliveOptionsgetKeepAlive()Returns the TCP keepalive options.booleanisKeepAlive()Returns whether to enable TCP keepalive.booleanisTcpNoDelay()Returns whether to use TCP NoDelay.SocketOptions.Buildermutate()Returns a builder to create newSocketOptionswhose settings are replicated from the currentSocketOptions.
-
Field Details
-
DEFAULT_CONNECT_TIMEOUT
public static final long DEFAULT_CONNECT_TIMEOUT- See Also:
- Constant Field Values
-
DEFAULT_CONNECT_TIMEOUT_UNIT
-
DEFAULT_CONNECT_TIMEOUT_DURATION
-
DEFAULT_SO_KEEPALIVE
public static final boolean DEFAULT_SO_KEEPALIVE- See Also:
- Constant Field Values
-
DEFAULT_SO_NO_DELAY
public static final boolean DEFAULT_SO_NO_DELAY- See Also:
- Constant Field Values
-
-
Constructor Details
-
SocketOptions
-
SocketOptions
-
-
Method Details
-
copyOf
Create a copy of options- Parameters:
options- the original- Returns:
- A new instance of
SocketOptionscontaining the values of options
-
builder
Returns a newSocketOptions.Builderto constructSocketOptions.- Returns:
- a new
SocketOptions.Builderto constructSocketOptions.
-
create
Create a newSocketOptionsusing default settings.- Returns:
- a new instance of default cluster client client options.
-
mutate
Returns a builder to create newSocketOptionswhose settings are replicated from the currentSocketOptions.- Returns:
- a
SocketOptions.Builderto create newSocketOptionswhose settings are replicated from the currentSocketOptions - Since:
- 5.3
-
getConnectTimeout
Returns the connection timeout.- Returns:
- the connection timeout.
-
isKeepAlive
public boolean isKeepAlive()Returns whether to enable TCP keepalive.- Returns:
- whether to enable TCP keepalive
- See Also:
SocketOptions.SO_KEEPALIVE
-
getKeepAlive
Returns the TCP keepalive options.- Returns:
- TCP keepalive options
- See Also:
SocketOptions.KeepAliveOptions
-
isTcpNoDelay
public boolean isTcpNoDelay()Returns whether to use TCP NoDelay.- Returns:
trueto disable Nagle's algorithm,falseto enable Nagle's algorithm.- See Also:
SocketOptions.TCP_NODELAY
-