java.lang.Object
io.lettuce.core.cluster.SlotHash
public class SlotHash extends Object
Utility to calculate the slot from a key.
- Since:
- 3.0
- Author:
- Mark Paluch
-
Field Summary
Fields Modifier and Type Field Description static intSLOT_COUNTNumber of redis cluster slot hashes.static byteSUBKEY_ENDConstant for a subkey end.static byteSUBKEY_STARTConstant for a subkey start. -
Method Summary
Modifier and Type Method Description static intgetSlot(byte[] key)Calculate the slot from the given key.static intgetSlot(String key)Calculate the slot from the given key.static intgetSlot(ByteBuffer key)Calculate the slot from the given key.
-
Field Details
-
SUBKEY_START
public static final byte SUBKEY_STARTConstant for a subkey start.- See Also:
- Constant Field Values
-
SUBKEY_END
public static final byte SUBKEY_ENDConstant for a subkey end.- See Also:
- Constant Field Values
-
SLOT_COUNT
public static final int SLOT_COUNTNumber of redis cluster slot hashes.- See Also:
- Constant Field Values
-
-
Method Details
-
getSlot
Calculate the slot from the given key.- Parameters:
key- the key- Returns:
- slot
-
getSlot
public static int getSlot(byte[] key)Calculate the slot from the given key.- Parameters:
key- the key- Returns:
- slot
-
getSlot
Calculate the slot from the given key.- Parameters:
key- the key- Returns:
- slot
-