Principle of locality

Because cache is small and expensive, it would be cool if we knew what memory is being frequently accessed. So we could put it in the best cache level possible.
One such property of programs that we can take advantage of is called Locality.

Temporal

If a memory address has been accessed, there is a good chance that it will be accessed again soon.
An example would be looping.

Spatial

If a memory address has been accessed, there is a good chance the memory nearby it will be accessed. All programs have spatial locality, as instructions are executed sequentially.

Loop exhibit both temporal and spatial locality.