Package redis.clients.jedis
Class JedisCluster
- java.lang.Object
-
- redis.clients.jedis.UnifiedJedis
-
- redis.clients.jedis.JedisCluster
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class JedisCluster extends UnifiedJedis
JedisCluster compatibility wrapper that extends UnifiedJedis for cluster operations. This class provides the traditional JedisCluster API while using the unified interface underneath.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_ATTEMPTSDefault amount of attempts for executing a commandstatic intDEFAULT_TIMEOUTDefault timeout in milliseconds.static java.lang.StringINIT_NO_ERROR_PROPERTY-
Fields inherited from class redis.clients.jedis.UnifiedJedis
baseClient, closed, config, glideClient, glideClusterClient, isClusterMode, resourceId
-
-
Constructor Summary
Constructors Constructor Description JedisCluster(java.util.Set<HostAndPort> nodes)Creates a JedisCluster with multiple entry points.JedisCluster(java.util.Set<HostAndPort> nodes, int timeout)Creates a JedisCluster with multiple entry points.JedisCluster(java.util.Set<HostAndPort> nodes, int timeout, int maxAttempts)Creates a JedisCluster with multiple entry points.
You can specify the timeout and the maximum attempts.JedisCluster(java.util.Set<HostAndPort> nodes, int timeout, int maxAttempts, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)JedisCluster(java.util.Set<HostAndPort> nodes, int timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)JedisCluster(java.util.Set<HostAndPort> nodes, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)JedisCluster(java.util.Set<HostAndPort> nodes, JedisClientConfig clientConfig)JedisCluster(java.util.Set<HostAndPort> nodes, JedisClientConfig clientConfig, int maxAttempts)JedisCluster(HostAndPort node)Creates a JedisCluster instance.JedisCluster(HostAndPort node, int timeout)Creates a JedisCluster instance.JedisCluster(HostAndPort node, int timeout, int maxAttempts)Creates a JedisCluster instance.JedisCluster(HostAndPort node, int timeout, int maxAttempts, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)JedisCluster(HostAndPort node, int timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)JedisCluster(HostAndPort node, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)JedisCluster(HostAndPort node, JedisClientConfig clientConfig, int maxAttempts, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,ConnectionPool>getClusterNodes()Returns all nodes that were configured to connect to in key-value pairs (Map).
Key is the HOST:PORT and the value is the connection pool.ConnectiongetConnectionFromSlot(int slot)Returns the connection for one of the 16,384 slots.-
Methods inherited from class redis.clients.jedis.UnifiedJedis
append, append, bitcount, bitcount, bitcount, bitcount, bitcount, bitcount, bitfield, bitfield, bitfieldReadonly, bitfieldReadonly, bitop, bitop, bitpos, bitpos, bitpos, bitpos, checkNotClosed, close, copy, copy, decr, decr, decrBy, decrBy, del, del, del, del, dump, dump, exists, exists, exists, exists, expire, expire, expire, expire, expireAt, expireAt, expireAt, expireAt, expireTime, expireTime, get, get, getbit, getbit, getDel, getDel, getEx, getEx, getrange, getrange, getSet, getSet, incr, incr, incrBy, incrBy, incrByFloat, incrByFloat, isClosed, keys, keys, mget, mget, migrate, migrate, migrate, migrate, move, mset, mset, msetnx, msetnx, persist, persist, pexpire, pexpire, pexpire, pexpire, pexpireAt, pexpireAt, pexpireAt, pexpireAt, pexpireTime, pexpireTime, pfadd, pfadd, pfcount, pfcount, pfcount, pfcount, pfmerge, pfmerge, ping, ping, psetex, psetex, pttl, pttl, randomKey, rename, rename, renamenx, renamenx, restore, restore, restore, restore, scan, scan, scan, scan, scan, scan, select, set, set, set, set, setbit, setbit, setex, setex, setGet, setGet, setGet, setGet, setnx, setnx, setrange, setrange, sort, sort, sort, sort, sort, sort, sort, sort, sortReadonly, sortReadonly, strlen, strlen, substr, substr, touch, touch, touch, touch, ttl, ttl, type, type, unlink, unlink, unlink, unlink
-
-
-
-
Field Detail
-
INIT_NO_ERROR_PROPERTY
public static final java.lang.String INIT_NO_ERROR_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
Default timeout in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_MAX_ATTEMPTS
public static final int DEFAULT_MAX_ATTEMPTS
Default amount of attempts for executing a command- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JedisCluster
public JedisCluster(HostAndPort node)
Creates a JedisCluster instance. The provided node is used to make the first contact with the cluster.Here, the default timeout of 2000 ms is being used with 5 maximum attempts.
- Parameters:
node- Node to first connect to.
-
JedisCluster
public JedisCluster(HostAndPort node, int timeout)
Creates a JedisCluster instance. The provided node is used to make the first contact with the cluster.Here, the default timeout of 2000 ms is being used with 5 maximum attempts.
- Parameters:
node- Node to first connect to.timeout- connection and socket timeout in milliseconds.
-
JedisCluster
public JedisCluster(HostAndPort node, int timeout, int maxAttempts)
Creates a JedisCluster instance. The provided node is used to make the first contact with the cluster.
You can specify the timeout and the maximum attempts.- Parameters:
node- Node to first connect to.timeout- connection and socket timeout in milliseconds.maxAttempts- maximum attempts for executing a command.
-
JedisCluster
public JedisCluster(HostAndPort node, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(HostAndPort node, int timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(HostAndPort node, int timeout, int maxAttempts, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(HostAndPort node, JedisClientConfig clientConfig, int maxAttempts, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes)
Creates a JedisCluster with multiple entry points.Here, the default timeout of 2000 ms is being used with 5 maximum attempts.
- Parameters:
nodes- Nodes to connect to.
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, int timeout)
Creates a JedisCluster with multiple entry points.Here, the default timeout of 2000 ms is being used with 5 maximum attempts.
- Parameters:
nodes- Nodes to connect to.timeout- connection and socket timeout in milliseconds.
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, int timeout, int maxAttempts)
Creates a JedisCluster with multiple entry points.
You can specify the timeout and the maximum attempts.- Parameters:
nodes- Nodes to connect to.timeout- connection and socket timeout in milliseconds.maxAttempts- maximum attempts for executing a command.
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, int timeout, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, int timeout, int maxAttempts, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> poolConfig)
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, JedisClientConfig clientConfig)
-
JedisCluster
public JedisCluster(java.util.Set<HostAndPort> nodes, JedisClientConfig clientConfig, int maxAttempts)
-
-
Method Detail
-
getClusterNodes
public java.util.Map<java.lang.String,ConnectionPool> getClusterNodes()
Returns all nodes that were configured to connect to in key-value pairs (Map).
Key is the HOST:PORT and the value is the connection pool.- Returns:
- the map of all connections.
-
getConnectionFromSlot
public Connection getConnectionFromSlot(int slot)
Returns the connection for one of the 16,384 slots.- Parameters:
slot- the slot to retrieve the connection for.- Returns:
- connection of the provided slot.
-
-