LRU Cache (Least Recently Used) Playground

Fixed-capacity cache: full → evict the least recently used. Does get change the order too? Click put/get, watch recency shift + hit rate. An interactive LRU…

Why it matters

LRU sits in browser and CDN caches, database caches, memoisation and the operating system’s page cache. One rule, "what was used recently will likely be used again", lets a small cache answer most requests. The key: get changes the order too.

The key idea

A Map whose insertion order is the order of use

Common mistakes

Try it in this playground