Skip to content

@xtandard/kit/storage/redis

@xtandard/kit/storage/redis — Redis storage: createRedisStorage() (JSON strings) and createRedisJSONStorage() (RedisJSON documents) over node-redis, with an atomic Lua compare-and-swap, keyspace-notification watch and an onWrite hook.

Optional peer: redis (loaded on first use).

import { … } from "@xtandard/kit/storage/redis";
Name Summary
createRedisJSONStorage Create a Redis-backed RedisKvStorage storing native RedisJSON documents, queryable with JSONPath (JSON.GET app:key $.field) and indexable with RediSearch. Same options and semantics as createRedisStorage; never point it at keys written by createRedisStorage.
createRedisStorage Create a Redis-backed RedisKvStorage storing JSON strings.
Name Summary
RedisKvStorage A watchable, compare-and-swap capable storage backed by Redis, plus close().
RedisStorageOptions Options for createRedisStorage and createRedisJSONStorage.
RedisWriteContext What an RedisStorageOptions.onWrite hook receives besides the key and value.
Name Summary
RedisWriteHook A write hook (ADR 0004): called after every successful setItem, successful compareAndSwap (with the new value) and removeItem (with null, whether or not the key existed). An error thrown by the hook rejects the call; the write itself has already happened.
Name Documented on
RedisLike @xtandard/kit/storage/redis/internals