Documentation ¶
Index ¶
- func NewFixedWindowLimiter(client *redis.Client, limit int, window time.Duration) (ratelimit.RedisLimiter, error)
- func NewLeakyBucketLimiter(client *redis.Client, peakLevel, currentVelocity int) ratelimit.RedisLimiter
- func NewSlidingLogLimiter(client *redis.Client, smallWindow time.Duration, ...) (ratelimit.RedisLimiter, error)
- func NewSlidingWindowLimiter(client *redis.Client, limit int, window, smallWindow time.Duration) (ratelimit.RedisLimiter, error)
- func NewTokenBucketLimiter(client *redis.Client, capacity, rate int) ratelimit.RedisLimiter
- type SlidingLogLimiterStrategy
- type ViolationStrategyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFixedWindowLimiter ¶
func NewLeakyBucketLimiter ¶
func NewLeakyBucketLimiter(client *redis.Client, peakLevel, currentVelocity int) ratelimit.RedisLimiter
func NewSlidingLogLimiter ¶
func NewSlidingLogLimiter(client *redis.Client, smallWindow time.Duration, strategies ...*SlidingLogLimiterStrategy) ( ratelimit.RedisLimiter, error)
func NewSlidingWindowLimiter ¶
func NewTokenBucketLimiter ¶
func NewTokenBucketLimiter(client *redis.Client, capacity, rate int) ratelimit.RedisLimiter
Types ¶
type SlidingLogLimiterStrategy ¶
type SlidingLogLimiterStrategy struct {
// contains filtered or unexported fields
}
SlidingLogLimiterStrategy 滑动日志限流器的策略
func NewSlidingLogLimiterStrategy ¶
func NewSlidingLogLimiterStrategy(limit int, window time.Duration) *SlidingLogLimiterStrategy
type ViolationStrategyError ¶
ViolationStrategyError 违背策略错误
func (*ViolationStrategyError) Error ¶
func (e *ViolationStrategyError) Error() string
Click to show internal directories.
Click to hide internal directories.