fixedwindow

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package fixedwindow implements the Fixed Window rate limiting algorithm.

Time is partitioned into discrete fixed windows (e.g., every 1 minute). A counter is incremented for each incoming request and resets to zero at the boundary of a new window.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy struct{}

Strategy implements the algorithm.Algorithm interface for Fixed Window.

func New

func New() *Strategy

New creates a new instance of the Fixed Window algorithm strategy.

func (*Strategy) EvaluateMemory

func (s *Strategy) EvaluateMemory(now time.Time, state *algorithm.State, limit int64, window time.Duration) algorithm.Result

EvaluateMemory evaluates the fixed window rate limit state synchronously in RAM.

func (*Strategy) Name

func (s *Strategy) Name() string

Name returns the unique identifier of the algorithm strategy.

func (*Strategy) RedisScript

func (s *Strategy) RedisScript() string

RedisScript returns the high-performance atomic Lua script utilizing Redis INCR.

Jump to

Keyboard shortcuts

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