Skip to content

@xtandard/flags/storage/redis

Redis storage: createRedisStorage (JSON strings) and createRedisJSONStorage (RedisJSON documents), with push-based change notifications. Optional peer dependency: redis (node-redis v4 or v5).

Subpath entry for @xtandard/flags/storage/redis: re-exports the adapters so the bundler can map them to their own dist file.

import { … } from "@xtandard/flags/storage/redis";
Name Summary
createRedisJSONStorage Create a Redis-backed RedisFlagsStorage that stores values as native RedisJSON documents (JSON.SET/JSON.GET) instead of strings — making the stored snapshots/drafts queryable with JSONPath (JSON.GET key $.flags) and indexable with RediSearch, while the flags system behaves identically.
createRedisStorage Create a Redis-backed RedisFlagsStorage. Connection is lazy: the client is created/connected on the first storage operation and reused thereafter, guarded by a single connection promise so concurrent calls connect once.
Name Summary
RedisFlagsStorage A watchable, compare-and-swap capable FlagsStorage 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: url or client, prefix, onError, onWrite.