part

package
v0.28.20240811150311 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limit

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

func New

func New(maxNum_in_period int, druation, druation_timeout string) *Limit

create a Limit Object it will allow maxNum_in_period requests(call TO()) in ms_in_period. if the request(call TO()) is out of maxNum_in_period,it will wait ms_to_timeout ms_to_timeout [>0:will wait ms] [=0:no wait] [<0:will block]

func (*Limit) Close

func (l *Limit) Close()

func (*Limit) IsLive added in v0.24.1

func (l *Limit) IsLive() bool

func (*Limit) PTK

func (l *Limit) PTK() int

return the token number of bucket at previous

func (*Limit) TK

func (l *Limit) TK() int

return the token number of bucket at now

func (*Limit) TO

func (l *Limit) TO() bool

the func will return true if the request(call TO()) is up to limit and return false if not

func (*Limit) WNum

func (l *Limit) WNum() int32

Jump to

Keyboard shortcuts

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