Skip to content

@xtandard/links/storage/redis

Redis storage: createRedisStorage() (JSON strings) and createRedisJSONStorage() (RedisJSON documents) over node-redis, with Lua compare-and-swap and keyspace-notification watch.

import { … } from "@xtandard/links/storage/redis";
Name Summary
createRedisJSONStorage 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.
createRedisStorage Create a Redis-backed RedisLinksStorage. Connection is lazy: the client is created/connected on the first storage operation and reused thereafter.
Name Summary
RedisLinksStorage A WatchableLinksStorage + CompareAndSwapLinksStorage backed by Redis, plus a close() method that disconnects the client — but only the one this adapter created. A client you passed in is left for you to manage.
RedisStorageOptions Options for createRedisStorage and createRedisJSONStorage.