class

KemalWAF::SlidingWindowCounter

Inherits Reference / Object

============================================================================= Sliding Window Counter (Simple, Correct Implementation)

Uses array of timestamps for accurate sliding window

Constructors

new(limit : Int32, window_sec : Int32)
Source

Instance methods

block(until_time : Time)

Block until specified time

Source
check(now : Time) : RateLimitResult

Check rate limit

Source
cleanup(now : Time) : Bool

Cleanup old requests

Source
should_evict?(now : Time, max_age_sec : Int32) : Bool

Check if this counter should be evicted

Source