ratelimiter

package
v0.9.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimiter

type RateLimiter interface {
	Allow(ctx context.Context, key string, quota int, duration time.Duration) (Result, error)
}

type RedisLimiter

type RedisLimiter struct {
	// contains filtered or unexported fields
}

func NewRedisLimiter

func NewRedisLimiter(client *redis.Client) *RedisLimiter

func (*RedisLimiter) Allow

func (rl *RedisLimiter) Allow(ctx context.Context, key string, quota int, duration time.Duration) (res Result, err error)

type Result

type Result struct {
	Allowed    bool
	Remaining  int
	Reset      time.Duration
	RetryAfter time.Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL