BETA

Design LRU Cache

We are given total possible page numbers that can be referred. We are also given cache (or memory) size (Number of page frames that cache can hold at a time). The LRU caching scheme is to remove the least recently used frame when the cache is full and a new page is referenced which is not there in the cache.

How will you design a LRU cache?

Note 1: While answering design pattern questions, it is expected from you to provide the Data Structure that would be best suited, different classes & relationships between them, etc. You need not provide the whole code in your answer (unless explicitly told to do so). 

Note 2: You can practice the question here

Login to Answer
Sort By:
Oldest
|
Newest
|
Vote
|
My Answer