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

how to clear old keys? #64

Open chetan-codehub opened 3 years ago

chetan-codehub commented 3 years ago

At any point if we want to clear data (that is created and used by rate_limit) from redis, how to do it?

something like :

rateLimiter.Clear("key") or rateLimiter.Flush()

tikhomirovv commented 4 months ago

@chetan-codehub, I suppose it should be like this:

rateLimiter := redis_rate.NewLimiter(rdb)
ctx := context.Background()
err := rateLimiter.Reset(ctx, "key")