juniorCaching

What is an LRU (Least Recently Used) cache?

Updated Apr 28, 2026

Short answer

An eviction policy that removes the item that hasn't been accessed for the longest time when the cache is full.

Deep explanation

Caching is essential for performance optimization. An eviction policy that removes the item that hasn't been accessed for the longest time when the cache is full. By reducing the need to access slower storage layers (like HDDs or remote databases), systems can achieve much lower latency.

Real-world example

Storing the results of a complex database query in Redis.

Common mistakes

  • Not setting a TTL, leading to the cache growing indefinitely or serving very old data.

Follow-up questions

  • Is cache persistent?

More Caching interview questions

View all →