createRedisStorage
function createRedisStorage(options): RedisWebhooksStorage;Defined in: src/storage/redis.ts:113
Create a Redis-backed RedisWebhooksStorage. Connection is lazy: the client is created/connected on the first storage operation and reused thereafter, guarded by a single connection promise so concurrent calls connect once.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
RedisStorageOptions |
Returns
Section titled “Returns”Example
Section titled “Example”import { createRedisStorage } from "@xtandard/webhooks/storage/redis";
const storage = createRedisStorage({ url: process.env.REDIS_URL ?? "redis://localhost:6379", prefix: "myapp:webhooks", onError: (err) => console.error("[webhooks/redis]", err),});
// Disconnect when the process exits:// process.on("SIGTERM", () => storage.close());