limiter

package
Version: v0.0.0-...-f87b766 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimiterIFS

type LimiterIFS interface {
	Acquire(timeout int) (string, error)                 // 获取一个
	Release(token string)                                // 释放
	GetTimeDuration(token string) (time.Duration, error) // 获取超时时间

	Init() // 重新初始化
}

func NewLimiter

func NewLimiter(ops ...Option) (lifs LimiterIFS)

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithLimit

func WithLimit(limit int) Option

WithLimit 设置最大并发数

func WithNamespace

func WithNamespace(namespace string) Option

WithNamespace 设置命名空间

func WithRedis

func WithRedis(redisClient myredis.RedisDial) Option

WithRedis 设置默认redis

func WithTsTimeout

func WithTsTimeout(isTsTimeout bool) Option

WithRedis 是否超时记录

Jump to

Keyboard shortcuts

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