Applying Locality to Cache Design
On access to data item n:
- Temporal locality says, “Item n was just used. We’ll probably use it again soon. Cache n.”
- Spatial locality says, “Item n was just used. We’ll probably use its neighbors soon. Cache n+1.”
The principles of locality give us an idea of which data is important, so we know which data to cache.