Interface RedisClusterCommands
- All Known Subinterfaces:
DefaultedRedisClusterConnection
,RedisClusterConnection
- All Known Implementing Classes:
JedisClusterConnection
,LettuceClusterConnection
public interface RedisClusterCommands
Interface for the cluster commands supported by Redis. A
RedisClusterNode
can be obtained from
clusterGetNodes()
or it can be constructed using either host
and
RedisNode.getPort()
or the node Id
.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clusterAddSlots
(RedisClusterNode node, int... slots) Assign slots to givenRedisClusterNode
.void
clusterAddSlots
(RedisClusterNode node, RedisClusterNode.SlotRange range) AssignRedisClusterNode.SlotRange.getSlotsArray()
to givenRedisClusterNode
.clusterCountKeysInSlot
(int slot) Count the number of keys assigned to one slot.void
clusterDeleteSlots
(RedisClusterNode node, int... slots) Remove slots fromRedisClusterNode
.void
RemovesRedisClusterNode.SlotRange.getSlotsArray()
from givenRedisClusterNode
.void
Remove given node from cluster.Get cluster information.List<byte[]>
clusterGetKeysInSlot
(int slot, Integer count) Get keys served by slot.Retrieve information about masters and their connected replicas.clusterGetNodeForKey
(byte[] key) Find theRedisClusterNode
serving given key.clusterGetNodeForSlot
(int slot) Find theRedisClusterNode
serving given slot.Retrieve cluster node information such as id, host, port and slots.clusterGetReplicas
(RedisClusterNode master) Retrieve information about connected replicas for given master node.clusterGetSlotForKey
(byte[] key) Find the slot for a givenkey
.void
clusterMeet
(RedisClusterNode node) Add given node to cluster.void
clusterReplicate
(RedisClusterNode master, RedisClusterNode replica) Assign a replica to given master.void
clusterSetSlot
(RedisClusterNode node, int slot, RedisClusterCommands.AddSlots mode)
-
Method Details
-
clusterGetNodes
Iterable<RedisClusterNode> clusterGetNodes()Retrieve cluster node information such as id, host, port and slots.- Returns:
- never null.
- See Also:
-
clusterGetReplicas
Retrieve information about connected replicas for given master node.- Parameters:
master
- must not be null.- Returns:
- never null.
- See Also:
-
clusterGetMasterReplicaMap
Map<RedisClusterNode,Collection<RedisClusterNode>> clusterGetMasterReplicaMap()Retrieve information about masters and their connected replicas.- Returns:
- never null.
- See Also:
-
clusterGetSlotForKey
Find the slot for a givenkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
clusterGetNodeForSlot
Find theRedisClusterNode
serving given slot.- Parameters:
slot
-- Returns:
-
clusterGetNodeForKey
Find theRedisClusterNode
serving given key.- Parameters:
key
- must not be null.- Returns:
-
clusterGetClusterInfo
ClusterInfo clusterGetClusterInfo()Get cluster information.- Returns:
- See Also:
-
clusterAddSlots
Assign slots to givenRedisClusterNode
.- Parameters:
node
- must not be null.slots
-- See Also:
-
clusterAddSlots
AssignRedisClusterNode.SlotRange.getSlotsArray()
to givenRedisClusterNode
.- Parameters:
node
- must not be null.range
- must not be null.- See Also:
-
clusterCountKeysInSlot
Count the number of keys assigned to one slot.- Parameters:
slot
-- Returns:
- See Also:
-
clusterDeleteSlots
Remove slots fromRedisClusterNode
.- Parameters:
node
- must not be null.slots
-- See Also:
-
clusterDeleteSlotsInRange
RemovesRedisClusterNode.SlotRange.getSlotsArray()
from givenRedisClusterNode
.- Parameters:
node
- must not be null.range
- must not be null.- See Also:
-
clusterForget
Remove given node from cluster.- Parameters:
node
- must not be null.- See Also:
-
clusterMeet
Add given node to cluster.- Parameters:
node
- must containhost
andRedisNode.getPort()
and must not be null.- See Also:
-
clusterSetSlot
- Parameters:
node
- must not be null.slot
-mode
- must not benull.- See Also:
-
clusterGetKeysInSlot
Get keys served by slot.- Parameters:
slot
-count
- must not be null.- Returns:
- See Also:
-
clusterReplicate
Assign a replica to given master.- Parameters:
master
- must not be null.replica
- must not be null.- See Also:
-