How to implement LRU Cache in Java

Caching is an important need in most of Applications. Let’s see how to implement an LRU cache in Java. LinkedHashMap is the key to implement, which provides a way to achieve the LRU functionality. Let’s see the code

The key to achieve LRU functionality is to implement removeEldestEntry() API. We maintain a variable which […]

Continue reading