class MemoryRateLimitStore
implements RateLimitStore

In-memory implementation of RateLimitStore.

Uses a fixed-window algorithm: each key tracks a window start time and a count. When the current time exceeds windowStart + windowMs, the window resets.

Constructors

MemoryRateLimitStore(runtime: IRuntimeServices)

Methods

increment(
key: string,
windowMs: number
): Promise<RateLimitResult>

Increment the counter for the given key within its window. Creates the window if it does not exist.

reset(key: string): Promise<void>

Reset the counter for the given key.

Usage

import { MemoryRateLimitStore } from "auth-plugin/src/index.ts";