Tutorials
Connect clients, roll back Redis writes with SQL, store binary data and build a transactional outbox.
These tutorials use the pgredis_demo database and pgredis_app role created in Quick start, with PostgreSQL listening on 127.0.0.1:5432 and the pgredis gateway listening on 127.0.0.1:6379.
Work through the examples in order:
- Connect a Redis client — authenticate over RESP2 and RESP3, switch logical databases with
SELECT, and write and read keys. - Roll back SQL and Redis together — modify a SQL table row and a Redis key in one PostgreSQL transaction and roll both back.
- Binary keys and values — store and read raw byte sequences containing
NUL(\x00) bytes throughredis.command_bin. - Transactional outbox — commit business rows and Redis Stream events in one transaction, then consume and acknowledge them idempotently with
XREADGROUPandXACK.
Authenticate with redis-cli or a driver, then write and read a key.
Use one PostgreSQL transaction for a business row and a Redis key.
Store and read byte-exact keys and values through RESP and redis.command_bin.
Commit business rows and Stream events together, then consume and acknowledge them.