Skip to content

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.

Parameter Type
options RedisStorageOptions

RedisWebhooksStorage

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());