LRU Cache
Explore how to implement an LRU cache class to manage limited capacity data efficiently. Learn to add, update, retrieve values, and evict least recently used entries when full. This lesson helps you master a common caching strategy essential for optimizing data storage and retrieval in coding interviews.
We'll cover the following...
We'll cover the following...
Statement
Implement an LRU cache class with the following functions:
- Init(capacity): Initializes an LRU cache with the capacity size.
- Set(key, value): Adds a new key-value pair or updates an