Module lettuce.core

Class SlotHash

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 Details

    • SUBKEY_START

      public static final byte SUBKEY_START
      Constant for a subkey start.
      See Also:
      Constant Field Values
    • SUBKEY_END

      public static final byte SUBKEY_END
      Constant for a subkey end.
      See Also:
      Constant Field Values
    • SLOT_COUNT

      public static final int SLOT_COUNT
      Number of redis cluster slot hashes.
      See Also:
      Constant Field Values
  • Method Details

    • getSlot

      public static final int getSlot​(String key)
      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

      public static int getSlot​(ByteBuffer key)
      Calculate the slot from the given key.
      Parameters:
      key - the key
      Returns:
      slot