ratelimits

package
v0.0.0-...-8d6936c Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package ratelimits implements a token bucket rate limiter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Limit

func Limit(conn redis.Conn, bucketID string, interval time.Duration, maxTokens int) (bool, error)

Limit implements a Token Bucket rate limiter (with the bucket filled to maxTokens after interval). It returns true if more than zero tokens exist in the bucket.

Types

This section is empty.

Jump to

Keyboard shortcuts

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