ratelimit

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Take

func Take(ctx context.Context, l Limiter)

Take ..

Types

type Limiter

type Limiter interface {
	Take(context.Context) time.Duration
}

Limiter ..

func NewLocalLimiter

func NewLocalLimiter(maximumRPS, burstableRPS int) Limiter

NewLocalLimiter ..

func NewRedisLimiter

func NewRedisLimiter(redisClient *redis.Client, maxRPS int) Limiter

NewRedisLimiter ..

type Local

type Local struct {
	*rate.Limiter
}

Local ..

func (Local) Take added in v0.5.4

func (l Local) Take(ctx context.Context) time.Duration

Take ..

type Redis

type Redis struct {
	*redis_rate.Limiter
	MaxRPS int
}

Redis ..

func (Redis) Take

func (r Redis) Take(ctx context.Context) time.Duration

Take ..

Jump to

Keyboard shortcuts

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