Implementing LRU Cache using LinkedHashMap in Java

preview_player
Показать описание
In this video you will learn how to implement LRU cache using LinkedHashMap in java
Below is the GitHub link to download source:
Рекомендации по теме
Комментарии
Автор

Sir With due respect, this is not the LRU cache implementation. Here you are randomly removing the oldest inserted object but it should not be the case with LRU. In LRU you have to remove the oldest referred object.

So to give example, Step 1: if the size is two and you have inserted 1001 and 1002
Step 2: You have referred 1001, get(1001)
Step 3: Insert 1003

This should evict 1002 instead of 1001.

subratkumarpadhi
Автор

Hi Kishan, can you please tell me during second run when you passed size as 2 why last two element got returned? I was thinking first two will be retuned.

sachinmandal
Автор

Sir How to get data without multiple request to Cache memory with Multiple Session at that time???

parassuryawanshi