18/37
Part 4 of 6 · Time limitsLearn and do
Lazy expiry: a get deletes the expired entry it finds, and nothing else does
Lazy expiry is the simplest way to honor a TTL: check on every read. A get that finds an expired entry deletes it and returns the default, as if it was never there. Redis does this too. Its docs say it expires keys in a passive way and an active way, and the passive way is this check on access.
Write 100,000 entries at time 0 with ttl=60. At time 61, read 1,000 of them. With lazy expiry only, how many expired entries are still stored?
Pick an answer above to see the rest