Skip to main content
Version: Next

MemoryRateLimitStorage

MemoryRateLimitStorage

In-memory storage implementation for rate limiting. Suitable for single-instance applications.

Signature
class MemoryRateLimitStorage implements RateLimitStorage {
get(key: string) => Promise<number>;
set(key: string, value: number) => Promise<void>;
delete(key: string) => Promise<void>;
}

get

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

Retrieves the current request count for a given key

set

method
(key: string, value: number) => Promise<void>

Sets the request count for a given key

delete

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

Deletes the rate limit entry for a given key