Skip to content

createRedisStorage

function createRedisStorage(options): RedisLinksStorage;

Defined in: src/storage/redis.ts:62

Create a Redis-backed RedisLinksStorage. Connection is lazy: the client is created/connected on the first storage operation and reused thereafter.

Parameter Type
options RedisStorageOptions

RedisLinksStorage

import { createRedisStorage } from "@xtandard/links/storage/redis";
const storage = createRedisStorage({
url: process.env.REDIS_URL ?? "redis://localhost:6379",
prefix: "myapp:links",
onError: (err) => console.error("[links/redis]", err),
});
// Disconnect when the process exits:
// process.on("SIGTERM", () => storage.close());