diff --git a/bucket/bucket.go b/bucket/bucket.go index c3e581a..c0b2b27 100644 --- a/bucket/bucket.go +++ b/bucket/bucket.go @@ -60,3 +60,14 @@ func Add( ) ([]redis.Z, error) { return AddWithValue(client, keySuffix, time.Now().UnixNano(), decay) } + +// Reset resets the given leaky bucket +func Reset( + client *redis.Client, + keySuffix string, +) error { + key := key(keySuffix) + + _, err := client.Del(key).Result() + return err +}