Skip to content

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:

  1. Connect a Redis client — authenticate over RESP2 and RESP3, switch logical databases with SELECT, and write and read keys.
  2. Roll back SQL and Redis together — modify a SQL table row and a Redis key in one PostgreSQL transaction and roll both back.
  3. Binary keys and values — store and read raw byte sequences containing NUL (\x00) bytes through redis.command_bin.
  4. Transactional outbox — commit business rows and Redis Stream events in one transaction, then consume and acknowledge them idempotently with XREADGROUP and XACK.

Commit business rows and Stream events together, then consume and acknowledge them.