Redis target
TwinCommit keeps Redis in sync with your source database. Each row becomes a Redis hash under a key built from a template, deletes remove the key, and you can also publish every change to a Redis Stream. Caches stay fresh without application code invalidating them.
Supported: Redis 7.x and 8.x · Redis Enterprise and Redis Cloud · Amazon ElastiCache and MemoryDB · Azure Cache for Redis · Valkey.
Configuration
Section titled “Configuration”target: type: redis url: rediss://default:${REDIS_PASSWORD}@redis.internal:6380/0 key_template: "{table}:{pk}" # e.g. orders:99812 ttl: 0 # 0 = no expiry stream: "" # optional: e.g. "cdc:{table}" to also XADD each change json: false # true = store rows as RedisJSON documents instead of hashesHow apply works
Section titled “How apply works”- Each source transaction is written in a
MULTI/EXECblock per Redis node. - Inserts and updates do
HSET key field value ...(orJSON.SET), and replace the whole hash so that removed columns disappear. - Deletes do
DEL key. - With
streamset, each change is also appended withXADD, including its operation and log position.
Checkpoint and delivery
Section titled “Checkpoint and delivery”The checkpoint is a hash under twincommit:checkpoint:<pipeline>, written in the same MULTI/EXEC block as the data on single-node and replicated deployments. On Redis Cluster, keys span slots, so the checkpoint is written after the batch completes. Writes are idempotent, so a replay after a crash produces the same end state (effectively-once). Stream consumers should deduplicate on the lsn field.
Permissions (ACL)
Section titled “Permissions (ACL)”ACL SETUSER twincommit on >******** ~* +@write +@read +multi +exec +@stream -@dangerous