ratelimit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 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(l Limiter)

Take ..

Types

type Limiter

type Limiter interface {
	Take() time.Time
}

Limiter ..

func NewLocalLimiter

func NewLocalLimiter(maxRPS int) Limiter

NewLocalLimiter ..

func NewRedisLimiter

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

NewRedisLimiter ..

type Local

type Local struct {
	localRatelimit.Limiter
}

Local ..

type Redis

type Redis struct {
	*redis_rate.Limiter
	Context context.Context
	MaxRPS  int
}

Redis ..

func (Redis) Take

func (r Redis) Take() time.Time

Take ..

Jump to

Keyboard shortcuts

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