memory

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 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 FixedWindowLimiter

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

FixedWindowLimiter implements fixed window counter algorithm.

func NewFixedWindowLimiter

func NewFixedWindowLimiter(limit int, window time.Duration) (*FixedWindowLimiter, error)

func (*FixedWindowLimiter) Allow

func (*FixedWindowLimiter) AllowN

func (*FixedWindowLimiter) ImplName

func (l *FixedWindowLimiter) ImplName() scene.ImplName

type LeakyBucketLimiter

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

LeakyBucketLimiter implements leaky bucket algorithm.

func NewLeakyBucketLimiter

func NewLeakyBucketLimiter(limit int, window time.Duration) (*LeakyBucketLimiter, error)

func (*LeakyBucketLimiter) Allow

func (*LeakyBucketLimiter) AllowN

func (*LeakyBucketLimiter) ImplName

func (l *LeakyBucketLimiter) ImplName() scene.ImplName

type SlidingWindowCounterLimiter

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

SlidingWindowCounterLimiter implements sliding window counter algorithm.

func NewSlidingWindowCounterLimiter

func NewSlidingWindowCounterLimiter(limit int, window time.Duration) (*SlidingWindowCounterLimiter, error)

func (*SlidingWindowCounterLimiter) Allow

func (*SlidingWindowCounterLimiter) AllowN

func (*SlidingWindowCounterLimiter) ImplName

type SlidingWindowLogLimiter

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

SlidingWindowLogLimiter implements sliding window log algorithm.

func NewSlidingWindowLogLimiter

func NewSlidingWindowLogLimiter(limit int, window time.Duration) (*SlidingWindowLogLimiter, error)

func (*SlidingWindowLogLimiter) Allow

func (*SlidingWindowLogLimiter) AllowN

func (*SlidingWindowLogLimiter) ImplName

func (l *SlidingWindowLogLimiter) ImplName() scene.ImplName

type TimeRateLimiter

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

TimeRateLimiter wraps golang.org/x/time/rate limiter per key.

func NewTimeRateLimiter

func NewTimeRateLimiter(limit int, window time.Duration) (*TimeRateLimiter, error)

func (*TimeRateLimiter) Allow

func (*TimeRateLimiter) AllowN

func (*TimeRateLimiter) ImplName

func (l *TimeRateLimiter) ImplName() scene.ImplName

type TokenBucketLimiter

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

TokenBucketLimiter implements token bucket algorithm.

func NewTokenBucketLimiter

func NewTokenBucketLimiter(limit int, window time.Duration) (*TokenBucketLimiter, error)

func (*TokenBucketLimiter) Allow

func (*TokenBucketLimiter) AllowN

func (*TokenBucketLimiter) ImplName

func (l *TokenBucketLimiter) ImplName() scene.ImplName

Jump to

Keyboard shortcuts

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