part

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 1 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

func (*Limit) TK

func (l *Limit) TK() int

return the token number of bucket

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

Jump to

Keyboard shortcuts

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