Interface ValkeyClusterCommands
- All Known Subinterfaces:
DefaultedValkeyClusterConnection,ValkeyClusterConnection
- All Known Implementing Classes:
JedisClusterConnection,LettuceClusterConnection,ValkeyGlideClusterConnection
public interface ValkeyClusterCommands
Interface for the cluster commands supported by Valkey. A
ValkeyClusterNode can be obtained from
clusterGetNodes() or it can be constructed using either host and
ValkeyNode.getPort() or the node Id.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidclusterAddSlots(ValkeyClusterNode node, int... slots) Assign slots to givenValkeyClusterNode.voidclusterAddSlots(ValkeyClusterNode node, ValkeyClusterNode.SlotRange range) AssignValkeyClusterNode.SlotRange.getSlotsArray()to givenValkeyClusterNode.clusterCountKeysInSlot(int slot) Count the number of keys assigned to one slot.voidclusterDeleteSlots(ValkeyClusterNode node, int... slots) Remove slots fromValkeyClusterNode.voidRemovesValkeyClusterNode.SlotRange.getSlotsArray()from givenValkeyClusterNode.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 theValkeyClusterNodeserving given key.clusterGetNodeForSlot(int slot) Find theValkeyClusterNodeserving given slot.Retrieve cluster node information such as id, host, port and slots.clusterGetReplicas(ValkeyClusterNode master) Retrieve information about connected replicas for given master node.clusterGetSlotForKey(byte[] key) Find the slot for a givenkey.voidclusterMeet(ValkeyClusterNode node) Add given node to cluster.voidclusterReplicate(ValkeyClusterNode master, ValkeyClusterNode replica) Assign a replica to given master.voidclusterSetSlot(ValkeyClusterNode node, int slot, ValkeyClusterCommands.AddSlots mode)
-
Method Details
-
clusterGetNodes
Iterable<ValkeyClusterNode> 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<ValkeyClusterNode,Collection<ValkeyClusterNode>> 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 theValkeyClusterNodeserving given slot.- Parameters:
slot-- Returns:
-
clusterGetNodeForKey
Find theValkeyClusterNodeserving given key.- Parameters:
key- must not be null.- Returns:
-
clusterGetClusterInfo
ClusterInfo clusterGetClusterInfo()Get cluster information.- Returns:
- See Also:
-
clusterAddSlots
Assign slots to givenValkeyClusterNode.- Parameters:
node- must not be null.slots-- See Also:
-
clusterAddSlots
AssignValkeyClusterNode.SlotRange.getSlotsArray()to givenValkeyClusterNode.- 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 fromValkeyClusterNode.- Parameters:
node- must not be null.slots-- See Also:
-
clusterDeleteSlotsInRange
RemovesValkeyClusterNode.SlotRange.getSlotsArray()from givenValkeyClusterNode.- 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 containhostandValkeyNode.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:
-