go-redis / redis_rate

Rate limiting for go-redis
https://redis.uptrace.dev/guide/go-redis-rate-limiting.html
BSD 2-Clause "Simplified" License
844 stars 101 forks source link

Added redis tag for redis key prefix to fix CROSSSLOT error in redis … #96

Open arunsingh22 opened 8 months ago

arunsingh22 commented 8 months ago

…cluster.

Added curly braces around the key prefix name makes it a redis-tag. redis-tag ensures that all the keys starting with this prefix are mapped to the same keyslot when redis which will fix CROSSSLOT error in redis cluster.In single instance mode all keyslots are present in same shard hence CROSSSLOT error will not happen.

arunsingh22 commented 8 months ago

Please review and close this PR asap. We are actually looking for this fix in the code because in a cluster env , if there is no redis -tag used then the keys get distributed among multiple shards which breaks the counting. This fix will ensure that all the keys are mapped to same shards even in cluster env.