Caching easy
What is the difference between Cache Eviction and Cache Expiration?
- A They are fundamentally identical terms that describe the same underlying mechanism for data removal.
- B Expiration is time-based (TTL); Eviction is space-based (removing items to make room when the cache is full).
- C Eviction is a voluntary action initiated by the client; Expiration is a mandatory action forced by the server.
- D Expiration removes the data from RAM permanently; Eviction merely swaps the data out to a slower disk-based store.
Answer: B. Expiration is time-based (TTL); Eviction is space-based (removing items to make room when the cache is full).
**Expiration** is time-based (TTL) and happens because data is 'too old'. **Eviction** is space-based (LRU/LFU) and happens because the cache is 'too full'. Ideally, items expire before they need to be evicted, but eviction ensures the cache never runs out of memory.
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?