RateLimiter Module
In-memory sliding window rate limiter. Tracks requests per key (typically client IP or DID) within a configurable window.
Types
| Type | Description |
|
A rate limiter instance that can be shared across requests. Internal implementation uses a ConcurrentDictionary of timestamp lists. |
Functions and values
| Function or value |
Description
|
|
|
Full Usage:
tryAllow key now state
Parameters:
string
now : DateTimeOffset
state : RateLimiterState
Returns: Result<int, float>
|
Try to allow a request for the given key. Returns Ok with the number of remaining requests, or Error with the seconds until the window resets.
|