Caching easy
Redis and Memcached store data in RAM. What is the primary implication of this for system design?
- A All data stored within the cache cluster is automatically encrypted at the hardware level during the write.
- B The data is ephemeral; the architecture must gracefully handle scenarios where the cache is empty or unavailable.
- C Utilizing RAM for storage is significantly more cost-effective per byte than utilizing modern NVMe SSD drives.
- D There is no theoretical or practical upper limit to the volume of data that can be efficiently stored in RAM.
Answer: B. The data is ephemeral; the architecture must gracefully handle scenarios where the cache is empty or unavailable.
RAM is **volatile memory**, meaning its contents are lost if the process crashes or the server loses power. Therefore, a caching system should always be treated as ephemeral. The application must be robust enough to handle a 'cold start' (empty cache) by fetching data from the persistent database of record.
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?