Redis
Redis Serialization Protocol (RESP) for client-server communication:
Message Format
Field | Description | Example Value |
---|---|---|
Type | First byte indicates data type | + (Simple String), - (Error), : (Integer), $ (Bulk String), * (Array) |
Data | Payload following type indicator | OK\r\n , 3\r\n , $5\r\nhello\r\n |
Terminator | CRLF sequence marking end of element | \r\n |
Data Types
Type | Indicator | Format | Example |
---|---|---|---|
Simple String | + | +<string>\r\n | +OK\r\n |
Error | - | -<error>\r\n | -ERR unknown command\r\n |
Integer | : | :<number>\r\n | :1000\r\n |
Bulk String | $ | $<length>\r\n<string>\r\n | $5\r\nhello\r\n |
Array | * | *<count>\r\n<elements> | *2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n |