informatikr / hedis

A Redis client library for Haskell.
http://hackage.haskell.org/package/hedis
BSD 3-Clause "New" or "Revised" License
330 stars 125 forks source link

Fix keyToSlot function. #206

Closed qnikst closed 1 year ago

qnikst commented 1 year ago

keyToSlot function contained several bugs, so it didn't work according to the spec and the values didn't match result of the CLUSTER KEYSLOT command.

In this commit we fix those bugs:

  1. Now tags are properly matched;
  2. Non matching tags return key calculated on entire string;
  3. First matching tag is used.

All the cases were tested with CLUSTER KEYSLOT command and added to the doctests. Unfortunatly it's not added to the full featured testsuite because running CLUSTR KEYSLOT command requirs running redis cluster

Fixes #203.