Versions in this module Expand all Collapse all v1 v1.0.1 Jun 16, 2021 v1.0.0 Jun 11, 2021 Changes in this version + const Allowed + const HitQuota + const OverQuota + const Unknown + var ErrUnknownCode = errors.New("unknown status code") + type PeriodLimit struct + func NewPeriodLimit(period, quota int, limitStore *redis.Redis, keyPrefix string, ...) *PeriodLimit + func (h *PeriodLimit) Take(key string) (int, error) + type PeriodOption func(l *PeriodLimit) + func Align() PeriodOption + type TokenLimiter struct + func NewTokenLimiter(rate, burst int, store *redis.Redis, key string) *TokenLimiter + func (lim *TokenLimiter) Allow() bool + func (lim *TokenLimiter) AllowN(now time.Time, n int) bool