rate

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	Use(ctx context.Context, tokens int) error
}

func New

func New(n int) Limiter

New rate limiter with a bucket size of and refill rate of n. For example, if n is 10, you could immediately use all 10 tokens, but if you want to use 10 more tokens, you'll need to wait a second for 10 tokens to be available.

Jump to

Keyboard shortcuts

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