Skip to main content
Persist the entire in-memory database to disk with SAVE, and restore it from a snapshot file with LOAD. Snapshots use the binary .rdbx format.

Syntax

SAVE filename
LOAD filename

Parameters

filename
string
required
Path to the snapshot file. If the filename does not end with .rdbx, the extension is appended automatically.

Return value

Both commands return OK on success.

Errors

CommandConditionError message
SAVECould not write to disk(error) could not write file
LOADFile not found(error) could not open file
LOADFile is corrupt or not RDBX format(error) invalid RDBX file
EitherWrong number of arguments(error) wrong number of arguments for 'SAVE' / 'LOAD'

Examples

Save the current database state and restore it after modifications:
>>> SET name radish
OK
>>> SET color red EX 100
OK
>>> SAVE backup
OK

>>> DEL name
(integer) 1
>>> GET name
(nil)

>>> LOAD backup
OK
>>> GET name
radish
The .rdbx extension is added automatically:
>>> SAVE mydata
OK
# Writes to: mydata.rdbx

>>> LOAD mydata.rdbx
OK
# .rdbx extension is accepted as-is

Notes

LOAD replaces the entire in-memory database. All current keys are discarded before the snapshot is applied. There is no merge — the loaded snapshot becomes the new database state.
After LOAD, the expiry sweeper is re-initialized (expire_init) so that TTL-based background expiry resumes correctly for keys restored from the snapshot.
Snapshots complement the append-only file (AOF) but do not replace it. After LOAD, the AOF continues to record all subsequent mutations. Consider taking a snapshot before destructive operations as an additional recovery point.
Use SAVE before LOAD to create a recovery point if the snapshot file might not be what you expect.

Build docs developers (and LLMs) love