Database / REDIS
Explain the lifecycle of a key with a TTL set in Redis?
A key's TTL doesn't trigger a background timer that fires exactly at expiration — Redis uses a combination of lazy and active strategies to actually reclaim expired keys, which is worth understanding since it explains some otherwise-surprising behavior around memory and replication.
The propagation detail in step J matters for consistency: replicas don't independently decide a key has expired based on their own clock — the master is the source of truth for expiration, and sends an explicit DEL/UNLINK to replicas once it expires a key, which avoids replicas disagreeing about whether a key is still valid due to clock drift or replication lag.
More Related questions...
