Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis cluster hashtag for a key which is a byte array

Tags:

redis

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?

like image 401
tez Avatar asked Oct 15 '25 15:10

tez


1 Answers

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.

like image 100
thepirat000 Avatar answered Oct 18 '25 20:10

thepirat000



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!