Documentation

Documentations

Persistence(RDB)

RESP-Encoded Key-Value Format (RDB)

In MyRedis, each key-value pair is stored directly in RESP format using bulk strings. Both the key and the value are written one after the other as raw RESP bytes.

Example:

Command: SET Name John

RDB Saved Format:

$4\r\nName\r\n$4\r\nJohn\r\n

Hex Representation:

24 34 0d 0a 4e 61 6d 65 0d 0a 24 34 0d 0a 4a 6f 68 6e 0d 0a

Command: SET Age 25

Saved: $3\r\nAge\r\n$2\r\n25\r\n

Hex:

24 33 0d 0a 41 67 65 0d 0a 24 32 0d 0a 32 35 0d 0a

When is it Triggered?

Only when the expiration command is mentioned only then the RDB file is not updated such as :

SET name satnam PX 10

In future versions, support for AOF (Append-Only File) and hybrid persistence may be added.