createRedisStorage
function createRedisStorage(options): RedisAuditStorage;Defined in: src/storage/redis.ts:78
Create a Redis-backed RedisAuditStorage. 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/audit/storage/redis";
const storage = createRedisStorage({ url: process.env.REDIS_URL ?? "redis://localhost:6379", prefix: "myapp:audit", onError: (err) => console.error("[audit/redis]", err),});
// Disconnect when the process exits:// process.on("SIGTERM", () => storage.close());