tez
tez

Reputation: 71

Redis cluster hashtag for a key which is a byte array

According to the Redis documentation, one can force-store keys in the same node using hashtags, i.e enclose the key within curly-braces {}. But it looks like the key must always be a string. Is there a way I can do that using byte[] keys?

Upvotes: 4

Views: 2268

Answers (1)

thepirat000
thepirat000

Reputation: 13114

The hash tag algorithm will look into the byte array until it finds the '{' character and the '}' character.

Those characters has the ASCII byte values of 123 (0x7B) and 125 (0x7D) respectively.

It doesn't matters if you have binary or string data, redis will scan your data, byte by byte, searching for the ocurrence of the values 123 and 125 on your data as a byte array. And what is between those values will be used to map to the hash slot.

Upvotes: 4

Related Questions