Skip to content

createRedisJSONStorage

function createRedisJSONStorage(options): RedisWebhooksStorage;

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

Create a Redis-backed RedisWebhooksStorage that stores values as native RedisJSON documents (JSON.SET/JSON.GET) instead of strings — making the stored records queryable with JSONPath (JSON.GET key $.status) and indexable with RediSearch, while the webhooks system behaves identically.

Requires the JSON module on the server (built into Redis 8; Redis Stack; or redisjson loaded). Same options and semantics as createRedisStorage, including lazy connection, SCAN-based getKeys, keyspace-notification watch, and the native due-queue claimDue. Do not point it at keys written by createRedisStorage (or vice versa) — the underlying types differ and Redis answers WRONGTYPE.

Parameter Type
options RedisStorageOptions

RedisWebhooksStorage

import { createRedisJSONStorage } from "@xtandard/webhooks/storage/redis";
const storage = createRedisJSONStorage({
url: process.env.REDIS_URL ?? "redis://localhost:6379",
prefix: "myapp:webhooks",
});
// Then, in redis-cli: JSON.GET myapp:webhooks:whk/acme/deliveries/dlv_1 $.status