Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowResult ¶
type LocalAsyncRedisLimiter ¶
type LocalAsyncRedisLimiter struct {
// contains filtered or unexported fields
}
func NewLocalAsyncRedisLimiter ¶
func NewLocalAsyncRedisLimiter(client redis.UniversalClient, options Options) *LocalAsyncRedisLimiter
func (*LocalAsyncRedisLimiter) TryAcquire ¶
func (r *LocalAsyncRedisLimiter) TryAcquire(token int64) bool
type LocalLimiter ¶
type LocalLimiter struct {
// contains filtered or unexported fields
}
func NewLocalLimiter ¶
func NewLocalLimiter(options Options) *LocalLimiter
func (*LocalLimiter) Allow ¶
func (l *LocalLimiter) Allow(ctx context.Context, key string) *AllowResult
type RateLimitingMiddleware ¶
type RateLimitingMiddleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(options Options) (*RateLimitingMiddleware, error)
func (*RateLimitingMiddleware) ServeHTTP ¶
func (m *RateLimitingMiddleware) ServeHTTP(ctx context.Context, c *app.RequestContext)
type RedisLimiter ¶
type RedisLimiter struct {
// contains filtered or unexported fields
}
func NewRedisLimiter ¶
func NewRedisLimiter(client redis.UniversalClient, options Options) *RedisLimiter
func (*RedisLimiter) Allow ¶
func (l *RedisLimiter) Allow(ctx context.Context, key string) *AllowResult
type StrategyMode ¶
type StrategyMode string
const ( Local StrategyMode = "local" Redis StrategyMode = "redis" LocalAsyncRedis StrategyMode = "local-async-redis" // nolint )
Click to show internal directories.
Click to hide internal directories.