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 period, it will store occurs during every time slice interval: (now ~ now - intervl), (now - intervl ~ now - 2*intervl)...
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 max times per period
Click to show internal directories.
Click to hide internal directories.