@xtandard/audit/storage/redis
Redis storage: createRedisStorage() (JSON strings) and
createRedisJSONStorage() (RedisJSON documents) over node-redis, with a Lua
compare-and-swap (safe multi-writer appends) and keyspace-notification watch.
KV only — events use the core’s generic KV event log.
import { … } from "@xtandard/audit/storage/redis";Functions
Section titled “Functions”| Name | Summary |
|---|---|
createRedisJSONStorage |
Create a Redis-backed RedisAuditStorage that stores values as native RedisJSON documents (JSON.SET/JSON.GET) instead of strings — making the stored records queryable with JSONPath (JSON.GET key $.action) and indexable with RediSearch, while the audit system behaves identically. |
createRedisStorage |
Create a Redis-backed RedisAuditStorage. 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. |
Type aliases
Section titled “Type aliases”| Name | Summary |
|---|---|
RedisAuditStorage |
A watchable, compare-and-swap capable storage 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: a url or a pre-connected client, an optional key prefix (joined with :), an onError observer for client error events, and an onWrite hook. |