How does an entry with a fixed deadline behave differently from one with an idle deadline pushed forward by every access?
answer
- two shapes, one promise
- measured from write, or from last access
- does traffic move the deadline?
- steady access means no end date
- an absolute cap sits above the idle one
basics
~20 sA fixed deadline is set when the entry is written and never moves, so total life is bounded no matter how busy the entry is. An idle deadline is pushed forward by access, so it removes only entries that have gone quiet.
solid answer
~50 sBoth shapes end in the same event — the store stops serving the entry once the deadline passes — but they answer different questions. A **fixed deadline** is computed once at write time and never moves, so total residency is bounded by the clock whatever the traffic does; that is what you want when a value must not be served past a known age. An **idle deadline** is measured from the last access, so the entry survives while the gaps between accesses stay shorter than the lifetime and lapses only after a quiet stretch; that is what you want when the point is to drop what nobody is using. Two consequences follow: a fixed deadline can remove an entry that is in active use, and an idle deadline never removes an entry whose accesses stay closer together than the lifetime, so a busy entry can outlive its reason unless an absolute cap sits above it.
go deeper
Recall the measuring point. A fixed deadline counts from the moment the value was written; an idle deadline counts from the last time anything touched the entry. Everything else follows from that one difference.
Explain the mechanics: which workload each shape fits, and that an idle deadline usually means the caller issues an extra operation on every access rather than flipping a switch on the store.
Show the failure you have seen: an entry under an idle deadline that steady traffic keeps resident forever while its remaining lifetime always reads healthy, and the absolute cap you added above it.
Frame it as a contract. Decide which state in the tier may be entrusted to a moving deadline at all, and state the posture in terms that hold across stores that refresh on access and stores that never will.
## Two shapes of one promise An entry's **lifetime** is a duration the store holds it for; the instant that duration ends is the **deadline**. Once the deadline passes, a reader is not served the entry any more — that is the whole of the promise the store makes, and it is the same promise in both shapes. This leaf is about one question asked after the deadline is first attached: **does anything move it?** - A **fixed deadline** is computed once, when the value is written, and never moves. The entry's total residency is bounded by construction: write plus lifetime, and that is the end of it. - An **idle deadline** is measured from the *last access* rather than from the write. Every access pushes it forward by a fresh lifetime, so the entry survives while it is in use and lapses only after a quiet stretch as long as the lifetime. The difference is not "short versus long". Two entries can carry the same lifetime and behave completely differently: under a fixed deadline the entry is gone at a predictable instant; under an idle deadline nobody can say in advance when it goes, because the answer depends on traffic that has not happened yet. ## What each shape is for | The question you are actually answering | Shape | Why it fits | |---|---|---| | "This must stop being served a known time after it was produced, however popular it is." | A fixed deadline | Residency is bounded by the clock, and traffic cannot extend it. | | "Keep what is in use, drop what has gone quiet." | An idle deadline | The deadline tracks the last access, so the population follows usage. | | "Both — keep it while it is in use, but never past a hard age." | An idle deadline with an absolute cap above it | The idle part reclaims quiet entries, the cap bounds total life. | Concretely: a derived copy of something another system owns wants its life bounded regardless of how often it is read, so it takes a fixed deadline. An in-progress basket a shopper keeps coming back to wants to survive while the shopper is active and to vanish when they walk away, so it takes an idle deadline. *How long* either window should be is a separate design question and not this one; the shape comes first. ## What each shape costs - A fixed deadline **removes entries that are in use**. A path that was warm a second ago takes a miss, and every consumer must handle that, because nothing about the entry being popular delays the removal. - An idle deadline makes the stored population **traffic-shaped rather than time-shaped**. You cannot bound how much is held from the lifetime alone; it depends on how many distinct entries are being touched inside the window. - An idle deadline **has no ceiling of its own**. An entry accessed more often than the lifetime is long never reaches its deadline at all, and can stay resident indefinitely while still looking, to anything that reads its remaining lifetime, like an ordinary entry that will expire soon. - An idle deadline is usually **not free**, because in most designs the caller, not the store, is what pushes the deadline forward. ## Who actually moves an idle deadline This is the part candidates skip. Many stores in this class do not move a deadline on a read at all; some offer refreshing on access as an option, and some offer a single call that reads the value and extends the deadline together. Where none of that is available, "idle" is not a setting — it is a behaviour the caller implements by issuing an additional write on every access. That turns a read-heavy path into a write-heavy one, which is a cost a design has to be willing to pay, and it is why "the store does not do this for me" is a legitimate answer rather than a mistake. ## Where designs genuinely differ - Whether a deadline can be attached or changed **after** the write, or only at write time. - Whether a read can extend a deadline at all, and whether that is on by default or something the caller requests. - Whether the deadline is given to the store as a **duration** it counts down or as an **instant** the caller computed — which decides whose clock matters. - Whether a store offers both an idle deadline and a hard maximum age; most do not, which is why the cap is generally the caller's job. ## Answering it in an interview 1. Name the measuring point: a fixed deadline is measured from the write, an idle deadline from the last access. 2. Map each to a workload in one sentence — bounded residency against reclaiming what has gone quiet. 3. Add the two consequences that show you have run one: a fixed deadline takes entries out from under live callers, and an idle deadline plus steady traffic is an entry with no end date.
- An entry must disappear a known time after it is produced, however often it is read. Which shape, and what breaks if you pick the other?A fixed deadline, measured from the write. With an idle deadline, steady reads keep pushing the deadline out, so the entry can outlive its intended age indefinitely — and the failure is silent, because the entry looks healthy and its remaining lifetime always reads as a comfortable duration.
- Under an idle deadline, what does "the entry has gone quiet" actually mean?That one whole lifetime passed with no access. The deadline is measured from the last access, so the entry survives as long as consecutive accesses are closer together than the lifetime; a single gap longer than the lifetime is what ends it, not the total volume of traffic before or after.
A fixed deadline is a ticket stamped with the hour it stops being valid: it does not care how often you show it. An idle deadline is a storage unit the company clears out after a year with no visit — drop by every month and it is yours forever, which is why the contract also names a maximum term.
saying these in an interview costs you the question
- Treats an idle deadline as simply a longer fixed one
- Assumes every store pushes the deadline forward on a read
- Says a read restarts the countdown on a fixed deadline
- Believes a constantly read entry under an idle deadline expires anyway
- Picks an idle deadline for data whose total age must be bounded