Documentation

Documentations

RESP Protocol

The project uses the RESP (REdis Serialization Protocol) to encode and decode data between clients and the server. This protocol is lightweight, efficient, and easy to parse.

Supported RESP Types

Each RESP type maps directly to a variant in your internalRedisValue enum:

Simple String

Starts with +. Used for success messages.

+OK\r\n

Bulk String

Starts with $. Used for binary-safe strings like keys and values.

$5\r\nhello\r\n

Integer

Starts with :. Used for numeric replies, like result counts.

:100\r\n

Array

Starts with *. Represents a list of values (can be mixed types).

*3\r\n$3\r\nSET\r\n$4\r\nname\r\n$5\r\nAlice\r\n

Encoding Flow

Each command received from the client is decoded into aVec<RedisValue> and processed. The server responds by encoding the result back into a RESP message before sending it.

Why RESP?

  • Lightweight and easy to implement
  • Efficient for both string and binary data
  • Supports complex nested data via arrays
  • Used in production-grade systems like Redis itself

Future support for RESP3 and additional data types (Null, Error types) may be added as the system evolves.