Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter count total occurs during a time window w, it will store occurs during every time slice s: (now ~ now - s), (now - s ~ now - 2*s)...
func NewCounter ¶
NewCounter create a new Counter
type Limiter ¶
type Limiter struct { Counter // contains filtered or unexported fields }
Limiter a redis-based ratelimiter
func NewLimiter ¶
NewLimiter create a new redis-based ratelimiter the Limiter limits the rate to n times per w
Click to show internal directories.
Click to hide internal directories.