Mặc dù Redis là in-memory, nó có thể lưu dữ liệu xuống disk để dữ liệu sống sót qua các lần khởi động lại. Nó cung cấp hai cơ chế — RDB (snapshot tại một thời điểm) và AOF (log append-only của các thao tác) — với các đánh đổi độ bền/hiệu năng khác nhau.
RDB — snapshot tại một thời điểm
RDB takes SNAPSHOTS of the dataset at intervals, saving a compact binary file.
✓ Compact single-file backups; fast restarts (load the snapshot)
✓ Good for backups and disaster recovery; less impact on performance
✗ You can LOSE data since the last snapshot (e.g. last few minutes) if Redis crashes
→ Configure save points: e.g. "save after 900s if ≥1 change, 300s if ≥10 changes"
