[]previous and next page

createMemoryRateLimitStore

A bounded in-memory store: at most maxKeys buckets, least recently used evicted first, so a flood of distinct keys cannot grow memory.

A bounded in-memory store: at most maxKeys buckets, least recently used evicted first, so a flood of distinct keys cannot grow memory.

Import#

ts
import { createMemoryRateLimitStore } from "@shadow-js/dusk/server";

Signature#

ts
function createMemoryRateLimitStore(
  options: MemoryRateLimitStoreOptions = {},
): RateLimitStore & { readonly size: number }

Parameters#

Name Description
options Bound.

Returns#

The store, with a size for tests and metrics.

Examples#

ts
const store = createMemoryRateLimitStore({ maxKeys: 5_000 });