limitx

package
v0.0.0-...-0cfe510 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

func NewLimiter

func NewLimiter(redis *redis.Redis) *Limiter

获取限流器

func (*Limiter) PeriodLimit

func (l *Limiter) PeriodLimit(period, quota int) *limit.PeriodLimit

func (*Limiter) Take

func (l *Limiter) Take(period, quota int, key string) bool

func (*Limiter) TakeCtx

func (l *Limiter) TakeCtx(ctx context.Context, period, quota int, key string) bool

Jump to

Keyboard shortcuts

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