0

I am rate limiting my application by user. I want to clear a key by a given user in redis. How can I find how it is being stored in redis. There is a clear function in limits/storage that takes a key, but I don't know how the key is being stored in Redis

Avid
  • 1
  • 1
  • List your keys: https://redis.io/commands/KEYS – Klaus D. Sep 10 '21 at 04:56
  • Flask-limiter stores it in keyspace, and not able to read the key in the key space – Avid Sep 10 '21 at 05:41
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 15 '21 at 23:47

1 Answers1

0

flask limiter sets the key as

LIMITER/127.0.0.1/slow/1/1/day

so use SCAN - KEYS can end up taking out a production server

example when we are rate-limiting by IP address

127.0.0.1:6379> scan 0 match *127.0.0.1*
1) "0"
2) 1) "LIMITER/127.0.0.1/slow/1/1/day"

Be aware that Rate-Limiter sets a TTL on each key so it may be expired from the keyspace automatically and no longer be visible.

namizaru
  • 646
  • 3
  • 5