# redis

> The redis identity: Redis Serialization Protocol. Every field and what is required.

`redis` is the Redis serialization protocol (RESP). The target is `host:port` (default 6379). The step sends and receives raw bytes as hex, and the session persists across steps, so a solution can stage an exchange and continue it.

## Write it in English

A step reads as sentences, the same byte-session forms as [tcp](/docs/solution/identity/tcp/): `send hex "<hex>"` (or `send hex of "<text>"`), `receive <n> bytes`, `receive until "<hex>"`, `port <n>`, `timeout <n> seconds`, `close the connection`, and `expect ...`.

## Fields

`redis` uses the byte-session fields from [tcp](/docs/solution/identity/tcp/):

| field | required | what it does |
| --- | --- | --- |
| `send` | yes | the bytes to send, as hex or `hex "text"`; empty when a step only reads |
| `recv` | | how many bytes to read at most |
| `recv_until` | | stop reading once this hex marker appears |
| `timeout` | | how long to wait, in seconds |
| `close` | | end the session after this step |
| `capture` | | pull a value out of the received hex for later steps |

## Example

```text
redis handshake
  # send a RESP command and look for the reply
  send hex "2a310d0a24340d0a636f6e6669670d0a..."
  recv 4096
  expect "2b4f4b" in the response
```