Senior
LRU stores data at the application level — in what sense does cache behavior become unpredictable when scaling?
sobes.tech AI
Answer from AI
An application-level LRU cache stores data locally in the memory of a single instance. When scaling (for example, running multiple copies of the application), each instance has its own separate cache, which leads to:
- Data inconsistency: different instances may have different cache versions.
- Repeated caching: the same data may be stored in multiple caches, reducing efficiency.
- Invalidation difficulties: updating data requires synchronization between caches; otherwise, data becomes stale.
Thus, cache behavior becomes unpredictable, as there is no single source of truth and no consistency between instances.