package
0.0.7
Repository: https://github.com/beihai0xff/turl.git
Documentation: pkg.go.dev

# Functions

NewBucketRateLimiter creates a new BucketRateLimiter.
NewItemExponentialFailureRateLimiter creates a new ItemExponentialFailureRateLimiter with the specified base and max delays.
NewItemFastSlowRateLimiter creates a new ItemFastSlowRateLimiter with the specified fast and slow delays and the maximum number of fast attempts.
NewItemRedisTokenRateLimiter creates a new ItemRedisTokenRateLimiter.
NewMaxOfRateLimiter creates a new MaxOfRateLimiter with the specified limiters.

# Structs

BucketRateLimiter adapts a standard bucket to the RateLimiter API.
ItemExponentialFailureRateLimiter does a simple baseDelay*2^<num-failures> limit dealing with max failures and expiration are up to the caller.
ItemFastSlowRateLimiter does a quick retry for a certain number of attempts, then a slow retry after that.
ItemRedisTokenRateLimiter is a rate limiter that uses a token bucket in redis to rate limit items.
MaxOfRateLimiter calls every RateLimiter and returns the worst case response When used with a token bucket limiter, the capacity could be apparently exceeded in cases where particular items were separately delayed a longer time.

# Interfaces

RateLimiter is an interface that knows how to limit the rate at which something is processed It provides methods to decide how long an item should wait, to stop tracking an item, and to get the number of failures an item has had.