limiter

package
v0.10.8-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Capacity  int64
	Rate      int64
	Requested int64
}

Config 配置选项模式

type Option

type Option func(*Config)

func WithCapacity

func WithCapacity(c int64) Option

func WithRate

func WithRate(r int64) Option

func WithRequested

func WithRequested(n int64) Option

type RedisLimiter

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

func New

func New(ctx context.Context, r *redis.Client) *RedisLimiter

func (*RedisLimiter) Allow

func (rl *RedisLimiter) Allow(ctx context.Context, key string, opts ...Option) (bool, error)

Jump to

Keyboard shortcuts

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