Caching medium
You need a Redis cache that survives restarts with minimal data loss. Comparing RDB (Snapshot) vs AOF (Append Only File), which is true?
- A RDB is faster for recovery but can lose minutes of data; AOF offers higher durability (up to 1s or per-write) but has larger file sizes.
- B RDB provides exact point-in-time recovery with zero data loss.
- C AOF is deprecated and should not be used.
- D Neither supports persistence; Redis is strictly volatile.
Answer: A. RDB is faster for recovery but can lose minutes of data; AOF offers higher durability (up to 1s or per-write) but has larger file sizes.
Redis provides two persistence modes: **RDB (Snapshotting)** and **AOF (Append Only File)**. RDB takes periodic snapshots (e.g., every 5 minutes), so you can lose data since the last snapshot. AOF logs every write operation, offering high durability (up to 1 second or every write), but produces larger files that require periodic rewriting (compaction).
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- In the Cache-Aside pattern, what happens when the application requests data that is missing from the cache (a 'Cache Miss')?
- Why use a centralized Distributed Cache (like a Redis Cluster) over local in-memory caches on each web server?
- Setting a short TTL (e.g., 60 seconds) on a cached object helps to:
- What is the primary architectural goal of introducing a cache into a system?
- Most caching systems rely on the principle of 'Temporal Locality', which states:
- Your cache uses an LRU (Least Recently Used) eviction policy. When the cache is full, which item is removed?