How to link Redis keys to particular entity?

Viewed 163

I implemented Express rate limit middleware which persists its data in Redis. Each hit is saved against the user's ip and some details about the request url and method as one key string.

I want to allow the option to clear all of the keys associated of particular IP, how can I do that?

1 Answers

You should consider using a Hash key per IP, such that each value in the hash will be a different event.

This way when you delete the hash you delete all the events.

Related