Once the cache reaches it's max memory limit: - **LRU** - least recently used item would be removed (element on the bottom of the list) ![[lru_geeksforgeeks.png]] - **LFU** - least frequently used item would be removed. Each element in a cache memory has a counter, that helps to track how frequently specific item was used. **LRU** should be used when r**ecent access matters more than frequency**. Ideal for situations where users recently used data, like in web browsers, mobile apps. **LFU** should be used when **long-term popularity matters more than frequency**. Best for CDN caching. CDN caches videos, movies, images. Some items are requested thousand of times daily. Frequently accessed assets (for example - popular YT Video) should stay cached, even if they haven't been used recently. ###### Images by Geeksforgeeks.org ### See also 1. [[What is a LRU Cache?]] 2. [[What is a LFU Cache?]] ### Reference - [LRU Cache - Geeksforgeeks](https://www.geeksforgeeks.org/lru-cache-implementation/) -