fivenines

Practice / target 80%

Expiration System Practice

01

A key expired five minutes ago but has not been accessed. Why might it still occupy memory?

intro

Scenario

A memory profile shows keys whose TTLs passed long ago still resident in the keyspace.

02

What should `GET expired-key`, `EXISTS expired-key`, and startup recovery all agree on?

intro

Scenario

You are checking that every read path in the server treats a dead-but-undeleted key the same way.

03

Why do absolute expiration timestamps make persistence and recovery safer than relative TTLs?

applied

Scenario

You are choosing how TTL state should be recorded so it survives saves, restarts, and replication.

04

Compare passive expiration and active expiration by cost, precision, and coverage.

applied

Scenario

You are weighing the two expiration mechanisms that share responsibility for removing dead keys.

05

Why should expiration checks live in shared lookup logic instead of each command handler?

advanced

Scenario

A code review found a proposal to add TTL checks separately inside each command's handler.