Skip to content

createRedisJSONStorage

function createRedisJSONStorage(options): RedisLinksStorage;

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

Create a Redis-backed RedisLinksStorage that stores values as native RedisJSON documents (JSON.SET/JSON.GET) instead of strings. Requires the JSON module on the server (built into Redis 8; Redis Stack; or redisjson loaded). Same options and semantics as createRedisStorage. Do not point it at keys written by createRedisStorage (or vice versa) — the underlying types differ and Redis answers WRONGTYPE.

Parameter Type
options RedisStorageOptions

RedisLinksStorage

import { createRedisJSONStorage } from "@xtandard/links/storage/redis";
const storage = createRedisJSONStorage({
url: process.env.REDIS_URL ?? "redis://localhost:6379",
prefix: "myapp:links",
});