DurableObjectRateLimitStore
Defined in: src/adapters/durable-object.ts:87
Rate limit store backed by a Durable Object.
Each rate limit key maps to a unique DO instance, providing strongly consistent atomic counters that survive Worker eviction and work across isolates.
Example
Section titled “Example”import { DurableObjectRateLimitStore } from "@homegrower-club/stoma/adapters";
const store = new DurableObjectRateLimitStore(env.RATE_LIMITER);rateLimit({ max: 100, store });Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DurableObjectRateLimitStore(
namespace):DurableObjectRateLimitStore
Defined in: src/adapters/durable-object.ts:88
Parameters
Section titled “Parameters”namespace
Section titled “namespace”DurableObjectNamespace
Returns
Section titled “Returns”DurableObjectRateLimitStore
Methods
Section titled “Methods”increment()
Section titled “increment()”increment(
key,windowSeconds):Promise<{count:number;resetAt:number; }>
Defined in: src/adapters/durable-object.ts:90
Increment the counter for a key, returning the new count and TTL
Parameters
Section titled “Parameters”string
windowSeconds
Section titled “windowSeconds”number
Returns
Section titled “Returns”Promise<{ count: number; resetAt: number; }>