InMemoryRateLimitStore
Defined in: src/policies/traffic/rate-limit.ts:45
Sliding-window rate limiting with pluggable counter storage (priority 20).
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new InMemoryRateLimitStore(
options?):InMemoryRateLimitStore
Defined in: src/policies/traffic/rate-limit.ts:52
Parameters
Section titled “Parameters”options?
Section titled “options?”number | InMemoryRateLimitStoreOptions
Returns
Section titled “Returns”InMemoryRateLimitStore
Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: src/policies/traffic/rate-limit.ts:106
Stop the cleanup interval (for testing)
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”increment()
Section titled “increment()”increment(
key,windowSeconds):Promise<{count:number;resetAt:number; }>
Defined in: src/policies/traffic/rate-limit.ts:69
Increment the counter for a key, returning the new count and TTL
Parameters
Section titled “Parameters”string
windowSeconds
Section titled “windowSeconds”number
Returns
Section titled “Returns”Promise<{ count: number; resetAt: number; }>
Implementation of
Section titled “Implementation of”reset()
Section titled “reset()”reset():
void
Defined in: src/policies/traffic/rate-limit.ts:114
Reset all counters (for testing)
Returns
Section titled “Returns”void