PenaltyBox
type PenaltyBox struct { // contains filtered or unexported fields}PenaltyBox is a type that allows entries to be penalized for a given number of minutes in the future.
Methods
Add
View sourceAdd adds an entry to the penalty box for the given time-to-live (TTL) duration. The minimum value is 1 minute and the maximum is 60 minutes. If an entry is already in the penalty box, its TTL is replaced with the new value. Entries are automatically evicted from the penalty box when the TTL expires.
Parameters
- entry: string
- ttl: time.Duration
Returns
error
Has
View sourcefunc (pb *PenaltyBox) Has(entry string) (bool, error)Has returns true if the given entry is currently in the penalty box.
Parameters
- entry: string
Returns
(bool, error)