limiter

package
v0.0.0-...-2f866d2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: AGPL-3.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 Limiter

type Limiter interface {
	//是否触发限流
	//返回true就是限流
	Limit(ctx context.Context, key string) (bool, error)
}

func NewRedisSlidingWindowLimiter

func NewRedisSlidingWindowLimiter(cmd redis.Cmdable, interval time.Duration, rate int) Limiter

type RedisSlidingWindowLimiter

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

func (*RedisSlidingWindowLimiter) Limit

func (b *RedisSlidingWindowLimiter) Limit(ctx context.Context, key string) (bool, error)

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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