limitlion
limitlion copied to clipboard
Make limitlion compatiable with redis-cluster(redis-py-cluster)
We can leave hash tag decision to caller, but we will have to make sure that hash is always provided to make this compatible with redis-cluster, as Lua script will touch other keys which might not be available in same node and that will raise error. If we ensure { } is passed we should be good. Any suggestion on handling that?
After thinking about this a little more maybe leaving it to the caller isn't the best idea. At a minimum it makes the caller need to know about how hash tags are used in Redis clusters.
- Explicitly pass in both keys to the Lua script so it is clear what is being used (less magic in the Lua script the better). So move this line to the Python side.
- Include the prefix in the hash tag:
'{{throttle:{}}}'. At some point we could allow setting the prefix and I would assume you would want them included in the hash decision. - Add a note to the readme that explains the use of the hash tag in the key name for use with Redis clusters.
- We could add
redis_clustering=Falseas an argument tothrottle_configure()that can be used to enable the use of hash tags. That might make key names cleaner for non-cluster users.
Thoughts?