Versions in this module Expand all Collapse all v0 v0.0.9 Jun 28, 2021 Changes in this version + const CounterAlg + const LeakyBucketAlg + const LeakyBucketScript + const TokenBucketAlg + const TokenBucketScript + type BaseRateLimiter struct + type Counter struct + func NewCounter() *Counter + func (c *Counter) Incre() int + type CounterLimiter struct + N int64 + func (r *CounterLimiter) Take() (bool, error) + type LeakyBucketLimiter struct + func (r *LeakyBucketLimiter) Take() (bool, error) + type Limiter interface + Take func() (bool, error) + func NewCounterRateLimiter(client redis.Cmdable, key string, duration time.Duration, throughput int, ...) (Limiter, error) + func NewLeakyBucketLimiter(client redis.Cmdable, key string, duration time.Duration, throughput int) (Limiter, error) + func NewSlideTimeWindowLimiter(throughput int, duration time.Duration, windowBuckets int) (Limiter, error) + func NewTokenBucketRateLimiter(client redis.Cmdable, key string, duration time.Duration, throughput int, ...) (Limiter, error) + type SlideTimeWindowLimiter struct + func (s *SlideTimeWindowLimiter) Count() int + func (s *SlideTimeWindowLimiter) Take() (bool, error) + type TokenBucketLimiter struct + N int64 + func (r *TokenBucketLimiter) Take() (bool, error) v0.0.1 Aug 31, 2018