Skip to content

RateLimitStore

Defined in: packages/auth/src/ratelimit/rate-limit-store.ts:15

increment(key, windowSeconds, units?): Promise<RateLimitIncrementResult>

Defined in: packages/auth/src/ratelimit/rate-limit-store.ts:25

Atomically increment the counter at key by units (a positive integer, defaulting to 1). The window TTL must be applied on the first increment of a window (when the counter transitions from absent to units) and left untouched thereafter, giving a fixed window anchored at the first request.

Multi-unit increments let the limiter meter by actual work: a request that fans out into N downstream operations charges N units in one atomic step.

string

number

number

Promise<RateLimitIncrementResult>