Skip to content

Conversation

@eoghanmurray
Copy link
Contributor

Ref: #177

This is a fix for the non-use of MGET & MSET when in redis-cluster mode.

We (carefully) examine the keys to determine which can be grouped together as they use the same hash tag and hence go to the same slot.

…h slots (which determines that all keys go to the same cluster node)
@eoghanmurray eoghanmurray force-pushed the cluster-hash-tag-mget-mset branch from 9f23f46 to 1491595 Compare November 19, 2020 14:57
@eoghanmurray
Copy link
Contributor Author

Just now realise that there is some similar prior work on this:
predis/predis#149
I think the hash slot checks also satisfy those conditions:

  • IF the key contains a { character.
  • AND IF there is a } character to the right of {
  • AND IF there are one or more characters between the first occurrence of { and the first occurrence of }.

This is embodied in the following logic:

        if key.count('{') == key.count('}') == 1 and \
           -1 < key.index('{') < key.index('}') - 1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant