module Redis::Cluster::KeySlotConverter
def convert(key)
-
(Integer)
- slot number
Parameters:
-
key
(String
) -- the key of the redis command
def convert(key) crc = 0 key.each_byte do |b| crc = ((crc << 8) & 0xffff) ^ XMODEM_CRC16_LOOKUP[((crc >> 8) ^ b) & 0xff] end crc % HASH_SLOTS end