Skip to content
Ameen Abozaid
Planned lessonMID-037-L04

Eviction and TTL

  • Lesson 4 of 5
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

explain how a full cache decides what to drop and how entries expire.

Planned topics

  • Eviction applies when memory or size is full: LRU drops the least recently used, LFU the least frequently used.
  • LFU protects popular items from one-time scans; LRU adapts faster to changing demand.
  • TTL (time to live) removes an entry after a fixed time regardless of use; it bounds staleness.
  • Add random jitter to TTLs so entries do not all expire together (see MID-040).
Draft outline details

Demonstration

a 3-slot cache with accesses A B C A D: LRU evicts B; LFU evicts B or C (count 1), keeps A (count 2).

Check your understanding

What does TTL guarantee that eviction does not?

Show answer

An upper bound on how old an entry can be.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.