Why this matters
- LRU cache is a data-structure favourite — tests HashMap + linked list coordination.
- Appears in rate limiting, session stores, and CDN edge discussions.
- Thread-safe variant separates staff-level candidates from senior.
HashMap
key → Node
Doubly-linked list
head (MRU)
...
tail (LRU)
Requirements
Functional
get(key)returns value or absentput(key, value)inserts or updates; evicts least-recently-used when at capacity- Both operations must be O(1) average time
Non-functional
- Optional thread-safe variant for concurrent readers/writers
- Capacity fixed at construction
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 3 sections
- Data structures
- Thread safety
- CampusOS extension
Test yourself
Answer these before moving on — recall is what makes it stick.