Versions in this module Expand all Collapse all v0 v0.1.9 Oct 11, 2024 v0.1.8 Sep 4, 2024 Changes in this version + func NewTokenBucketRateLimiter(ctx context.Context, client redis.Cmdable, key string, duration time.Duration, ...) (ratelimit.Limiter, error) + type Option func(*TokenBucketLimiter) + func WithAntiDDos(antiDDoS bool) Option + func WithEnablePreFetch(preFetch bool) Option + func WithPreFetchCount(preFetchCount int64) Option + type TokenBucketLimiter struct + AntiDDoS bool + EnablePreFetch bool + N int64 + PreFetchCount int64 + func (r *TokenBucketLimiter) PreFetch() + func (r *TokenBucketLimiter) Take(ctx context.Context) (bool, error) + func (r *TokenBucketLimiter) Wait(ctx context.Context) (err error)