Versions in this module Expand all Collapse all v1 v1.2.3 Aug 16, 2024 Changes in this version + type Config struct + Burst int + CleanupInterval time.Duration + Mode Mode + Period time.Duration + Rate int + RedisClient *redis.Client + type Limiter interface + Allow func(ctx context.Context, key string) (bool, error) + Wait func(ctx context.Context, key string) error + func NewLimiter(opts ...Option) (Limiter, error) + type Mode int8 + const ModeRedis + const ModeTimeRate + type Option func(*Config) + func WithBurst(burst int) Option + func WithCleanupInterval(cleanupInterval time.Duration) Option + func WithMode(mode Mode) Option + func WithPeriod(period time.Duration) Option + func WithRate(rate int) Option + func WithRedisClient(client *redis.Client) Option