educative.io

Why used LRU not LFU for caching?

Have you thought about using LFU cache instead of LRU for URL caching? LRU just discards at the tail, but LFU is counting how many times an item was accessed. In my opinion, LFU is most suitable for hot URLs. Is this the case or is there a reason not to use LFU?

Hi,
LRU seems to be an optimal approach in this case. Because while working with different pages, there would be a high probability of the user wanting to access the recent pages instead of the ones he uses the most.
Both are correct solutions, you can use either one of them.
Regards,