✅ What is an LRU Cache?


🧠 Data Structures Used

Structure Why We Use It
unordered_map<Key, Node*> To find any key in O(1) time
Doubly-linked list To move nodes to front and remove from back in O(1)
std::mutex To safely allow multiple threads to use the cache

💡 Real-World Analogy

Think of:

Now imagine multiple people using the room at the same time — we need to make sure no two people change the list at the same time ⇒ that’s what mutex is for.


✅ How the Code Solves It

  1. Get operation (get(key)):