ratelimiter

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseLimitString

func ParseLimitString(limit string) (maxLimit, fillLimit int, fillRate time.Duration, err error)

ParseLimitString parse limit string into maxLimit, fillLimit & fillRate

Types

type Limiter

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

Limiter Leaky bucket alogorithm based limiter

func New

func New(limit string) *Limiter

New new

func (*Limiter) AvailableLimit

func (lb *Limiter) AvailableLimit() int

AvailableLimit AvailableLimit

func (*Limiter) Consume

func (lb *Limiter) Consume(duration int) (int, error)

Consume Consume

Source Files

Jump to

Keyboard shortcuts

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