Caching easy
Most caching systems rely on the principle of 'Temporal Locality', which states:
- A Data items that are stored physically close together in the database should be fetched as a single block.
- B If a specific data item is accessed once, it is statistically likely to be accessed again in the near future.
- C Data access patterns for a given dataset will always remain uniformly random across any given time period.
- D The total time required to access a specific memory address will naturally decrease as the system remains active.
Answer: B. If a specific data item is accessed once, it is statistically likely to be accessed again in the near future.
**Temporal Locality** is the principle that if a data location is referenced, it is likely to be referenced again soon. Caching exploits this: popularity is rarely random; it follows a power-law distribution (Zipf's Law) where a small set of items receives the majority of traffic.
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?
- Your cache uses an LRU (Least Recently Used) eviction policy. When the cache is full, which item is removed?
- Redis and Memcached store data in RAM. What is the primary implication of this for system design?