public enum RedisProtocol extends java.lang.Enum<RedisProtocol>
Three modes are supported:
null – combined with JedisClientConfig.isAutoNegotiateProtocol() the
client either skips the HELLO command altogether (auto-negotiation disabled,
legacy Jedis behaviour) or attempts HELLO 3 with a graceful RESP2
fallback (auto-negotiation enabled, the default for UnifiedJedis-based
clients).RESP2 – sends a HELLO 2 command requesting RESP2; the connection
fails if the server rejects the request.RESP3 – sends a HELLO 3 command requesting RESP3; the connection
fails if the server rejects the request.| Modifier and Type | Field and Description |
|---|---|
static RedisProtocol |
REDIS_SERVER_DEFAULT_PROTO |
| Modifier and Type | Method and Description |
|---|---|
static RedisProtocol |
from(java.lang.Long proto)
Returns the RedisProtocol enum value corresponding to the given protocol version number.
|
static RedisProtocol |
orServerDefault(RedisProtocol proto) |
static RedisProtocol |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static RedisProtocol[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
java.lang.String |
version() |
public static final RedisProtocol RESP2
public static final RedisProtocol RESP3
public static final RedisProtocol REDIS_SERVER_DEFAULT_PROTO
public static RedisProtocol[] values()
for (RedisProtocol c : RedisProtocol.values()) System.out.println(c);
public static RedisProtocol valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic java.lang.String version()
public static RedisProtocol from(java.lang.Long proto)
proto - the protocol version number (2 or 3)JedisProtocolNotSupportedException - if the protocol version is not recognizedpublic static RedisProtocol orServerDefault(RedisProtocol proto)
Copyright © 2026. All rights reserved.