ratelimiter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimiter

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

RateLimiter is the rate limiter.

func NewRateLimiter

func NewRateLimiter(len int) *RateLimiter

NewRateLimiter returns a new rate limiter.

func (*RateLimiter) Allow

func (rl *RateLimiter) Allow(id string, limit int, duration time.Duration) bool

Allow returns true if the operation is allowed.

Jump to

Keyboard shortcuts

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