ratelimit

package
v0.0.0-...-7efebb4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder(cmd redis.Cmdable, interval time.Duration, rate int) *Builder

func (*Builder) Build

func (b *Builder) Build() gin.HandlerFunc

func (*Builder) Prefix

func (b *Builder) Prefix(prefix string) *Builder

type Limiter

type Limiter interface {
	Limit(ctx context.Context, biz string) (bool, error)
}

func NewSlidingWindowLimiter

func NewSlidingWindowLimiter(client redis.Cmdable, interval time.Duration, rate int) Limiter

type WindowLimiter

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

func (*WindowLimiter) Limit

func (s *WindowLimiter) Limit(ctx context.Context, biz string) (bool, error)

Jump to

Keyboard shortcuts

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