part

package
v0.23.13 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 2 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, ms_in_period, ms_to_timeout int) *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) 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