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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidclusterAddSlots(RedisClusterNode node, int... slots) Assign slots to givenRedisClusterNode.voidclusterAddSlots(RedisClusterNode node, RedisClusterNode.SlotRange range) AssignRedisClusterNode.SlotRange.getSlotsArray()to givenRedisClusterNode.clusterCountKeysInSlot(int slot) Count the number of keys assigned to one slot.voidclusterDeleteSlots(RedisClusterNode node, int... slots) Remove slots fromRedisClusterNode.voidRemovesRedisClusterNode.SlotRange.getSlotsArray()from givenRedisClusterNode.voidRemove 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 theRedisClusterNodeserving given key.clusterGetNodeForSlot(int slot) Find theRedisClusterNodeserving 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.voidclusterMeet(RedisClusterNode node) Add given node to cluster.voidclusterReplicate(RedisClusterNode master, RedisClusterNode replica) Assign a replica to given master.voidclusterSetSlot(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 theRedisClusterNodeserving given slot.- Parameters:
slot-- Returns:
-
clusterGetNodeForKey
Find theRedisClusterNodeserving 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 containhostandRedisNode.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:
-