LRU Cache
Understand how to implement an LRU cache in JavaScript by creating a class with initialization, set, and get methods. Explore cache eviction strategies and learn how to maintain efficient data access within capacity constraints using the least recently used algorithm.
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