slidinglog

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSlidingLog

func NewSlidingLog(getClient func() *redis.Client, opts ...Option) (*slidingLog, error)

Types

type Option

type Option func(o *option)

func WithClock

func WithClock(clock clock.Clock) Option

func WithFledWindow added in v1.1.0

func WithFledWindow(l, r time.Time) Option

func WithKeyTTL added in v1.1.0

func WithKeyTTL(keyTTL time.Duration) Option

func WithLimit added in v1.1.0

func WithLimit(l int) Option

func WithWindow added in v1.1.0

func WithWindow(w time.Duration) Option

type SlidingLog

type SlidingLog interface {
	Allow(ctx context.Context, key string) (bool, error)
	SetLimit(limit int64)
	SetWindow(w time.Duration)
}

Jump to

Keyboard shortcuts

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