Tabcorp/redis-rate-limiter

Incompatible with Redis Cluster

brettpaden opened this issue · 1 comments

So it seems that the use of renamenx has limitations in redis cluster:

https://redislabs.com/redis-enterprise-documentation/database-configuration/database-clustering

"Renaming keys: The use of the RENAME / RENAMENX commands is allowed only when the key's original and new values are mapped to the same tag."

Just encountered this in a test environment with our application. I'm happy to take a stab at fixing this, but thought I would mention here first in case there is a workaround or someone already has a solution.

Thanks for raising this! The tag restriction for RENAME makes sense. Is it possible for you to implement a custom hashing policy to ensure that ratelimit:foo and ratelimittemp:foo are mapped to the same tag? For example:

ratelimit(temp)?\:{(?<tag>.*)}.*

I'd happy to change the naming structure as well if it makes the regexing easier, e.g. ratelimit:foo:temp so that the tag can be ratelimit:temp (exluding the foo).