tbf

package
v5.4.100 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenBucket

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

TokenBucket rate limiter

func New

func New(rate, burst float32) *TokenBucket

New creates a new TokenBucket rate limiter

func (*TokenBucket) Get

func (t *TokenBucket) Get(amount float32) bool

Get gets amount tokens from the bucket, non-blocking. Returns true if tokens were available, and false otherwise

Jump to

Keyboard shortcuts

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