Skip to main content
Version: 1.x

RateLimitEngine

RateLimitEngine

Coordinates algorithm selection and violation escalation per storage.

Signature
class RateLimitEngine {
constructor(storage: RateLimitStorage)
consume(key: string, config: ResolvedLimiterConfig) => Promise<RateLimitConsumeOutput>;
reset(key: string) => Promise<void>;
}

constructor

method
(storage: RateLimitStorage) => RateLimitEngine

Create a rate limit engine bound to a storage backend.

consume

method
(key: string, config: ResolvedLimiterConfig) => Promise<RateLimitConsumeOutput>

Consume a single key and apply escalation rules when enabled.

reset

method
(key: string) => Promise<void>

Reset a key and its associated violation state.