Builds the store. The client is resolved lazily on first use, so constructing this costs no connection.
Connection, injected client, runtime clock, key namespace
Optionalclient?: IRateLimitRedisClientOptionalcommandTimeoutMs?: numberBound on a built client's command, in ms; defaults to 15000. 0 omits the bound. Ignored for an injected client.
OptionalconnectionErrorReporter?: ConnectionErrorReporterReceives the connection errors (ioredis 'error' events) of the
client this store BUILDS, instead of ioredis printing each reconnect
failure to the console. Never attached to an injected client, which
belongs to the caller. This store is constructed by the application,
so no plugin supplies one: build it with createConnectionErrorReporter
from @setu-ts/common over your logger. Absent, the built client's
connection errors are dropped: nothing reaches the console or a log.
OptionalkeyPrefix?: stringNamespace prepended to every key this store reads and writes.
Defaults to DEFAULT_RATE_LIMIT_KEY_PREFIX.
keyGenerator produces keys such as anonymous and ip:203.0.113.7,
which are generic enough that two applications sharing one managed
Redis would count against each other's budget — service A's traffic
exhausting service B's limit. Pass a per-application value when one
Redis serves several.
Optionalurl?: stringClose the Redis connection (calls QUIT).
Increment the counter for the given key within its window. Creates the window if it does not exist.
Reset the counter for the given key.
Redis-backed rate limit store implementation.
Uses INCR (creates if missing) + PEXPIRE on first increment, then PTTL to derive resetTime. The store holds the runtime clock because PTTL returns a relative ms-remaining value, while the contract's RateLimitResult.resetTime must be an absolute epoch-ms timestamp.