Help us shape the future of Go! Take the 2026 Go Developer Survey

ratelimiter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 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