Redis/Valkey-backed KeyPersistenceAdapter for multi-node production deployments.
KeyPersistenceAdapter
The caller must supply a connected RedisClientType instance — this adapter does not open or close the connection.
RedisClientType
redis is listed as a peer dependency (>= 4.0.0). Install it separately:
redis
>= 4.0.0
npm install redis Copy
npm install redis
import { createClient } from 'redis';import { IdentityProvider } from '@one137th/mesh-semantic';import { RedisKeyPersistenceAdapter } from '@one137th/mesh-semantic';const client = createClient({ url: 'redis://localhost:6379' });await client.connect();const adapter = new RedisKeyPersistenceAdapter({ client, ttlSeconds: 604800 });const provider = new IdentityProvider({ keyPersistenceAdapter: adapter }); Copy
import { createClient } from 'redis';import { IdentityProvider } from '@one137th/mesh-semantic';import { RedisKeyPersistenceAdapter } from '@one137th/mesh-semantic';const client = createClient({ url: 'redis://localhost:6379' });await client.connect();const adapter = new RedisKeyPersistenceAdapter({ client, ttlSeconds: 604800 });const provider = new IdentityProvider({ keyPersistenceAdapter: adapter });
Load the persisted key set. Returns null if no persisted state exists yet (first startup).
null
Persist the current key set. Implementations should write atomically to avoid corruption.
Redis/Valkey-backed
KeyPersistenceAdapterfor multi-node production deployments.The caller must supply a connected
RedisClientTypeinstance — this adapter does not open or close the connection.redisis listed as a peer dependency (>= 4.0.0). Install it separately:Example