Interface: IRateLimitStore
Defined in: rate-limit.ts:85 Pluggable backend for rate-limit state. Implementations decide how counters are stored and how concurrency is resolved (in-memory, Redis, distributed log, …). Stores are designed to be reused across multiple(windowMs, maxRequests) configurations
keyed by the caller’s key (typically userId, ip, or
route + clientId).
Methods
check()
check(Defined in: rate-limit.ts:95 Atomically increment the counter forkey,windowMs,maxRequests):Promise<{limited:boolean;remaining:number;resetTime:number;total:number; }>
key within a sliding window
of windowMs and decide whether to allow the request.
Parameters
key
string
Caller-chosen identity key (e.g. "user:42").
windowMs
number
Window length in milliseconds.
maxRequests
number
Maximum requests permitted in the window.
Returns
Promise<{ limited: boolean; remaining: number; resetTime: number; total: number; }>
A RateLimitCheckResult describing the decision.
reset()
reset(Defined in: rate-limit.ts:100 Drop any state held forkey):Promise<void>
key. Useful for admin / unit-test reset
paths; not invoked by middleware itself.
Parameters
key
string
Returns
Promise<void>