Why a cache can be fast and temporarily outdated
A cache stores a reusable copy of data closer to where it is needed or in a faster form. A matching request can use that copy instead of repeating the original work. If the source changes before the cached copy is refreshed or removed, the cache may serve an older version.
Go deeper
Reuse an answer instead of rebuilding it
A cache keeps data or computed results that may be requested again. Reading the cached version can save network travel, database work or repeated calculation.
The challenge is deciding when the stored answer is no longer suitable. A time limit can expire entries, while explicit invalidation can remove them when a relevant change occurs.
Fast access and freshness are separate properties. A cache hit means a stored answer was found, not necessarily that it reflects the latest source state.
- Expiry limits how long an entry remains usable.
- Invalidation responds to a known change.
- Refreshing replaces old information with a newer result.
Different applications tolerate different delays. An old decorative image may be harmless, while an outdated availability result can affect a booking decision. The cache policy should reflect what the data means.