Backend Mystery · Card #44

How do you implement a server-side cache eviction strategy?

To define this strategy, you’ll need to define the following elements: - The size limit that will trigger the cache eviction when exceeded. - A monitoring strategy to determine if the eviction strategy is working properly or if it needs adjustment. - A cache invalidation mechanism. - And an eviction policy, which could be one of the following: - **LRU (Least Recently Used):** Evict the least recently accessed items. - **LFU (Least Frequently Used):** Remove items accessed least frequently. - **FIFO (First-In, First-Out):** Evict items in the order they were added. - **Random:** Randomly select items to evict. - **TTL (Time-To-Live):** Expire items after a certain time.
caching performance

Study the full deck →