Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter limits the number of added items.
It is safe using the Limiter from concurrent goroutines.
func NewLimiter ¶
NewLimiter creates new Limiter, which can hold up to maxItems unique items during the given refreshInterval.
func (*Limiter) Add ¶
Add adds h to the limiter.
It is safe calling Add from concurrent goroutines.
True is returned if h is added or already exists in l. False is returned if h cannot be added to l, since it already has maxItems unique items.
func (*Limiter) CurrentItems ¶
CurrentItems return the current number of items registered in l.
Click to show internal directories.
Click to hide internal directories.