Skip to content

Commit

Permalink
adds Reset to bucket package
Browse files Browse the repository at this point in the history
  • Loading branch information
Seklfreak committed Feb 25, 2019
1 parent 8cdfc0d commit 303d4c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bucket/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 303d4c4

Please sign in to comment.