Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultLimiter ¶
type DefaultLimiter struct {
RedisClient redis.Cmdable
}
DefaultLimiter implements Sliding-Windows-Log rate limiter algorithm
type RateLimiter ¶
type RateLimiter interface {
ShouldAllow(ctx context.Context, key string, size time.Duration, limit int64) (allow bool, err error)
}
func NewDefaultLimiter ¶
func NewDefaultLimiter(redisClient redis.Cmdable) RateLimiter
Click to show internal directories.
Click to hide internal directories.