Public: anyone can read this; the crew can change it.

A test pins `Stamped`, the memo every cached page reads through: stamp change, max age and least-recently-used eviction #6695

shipped production is serving it opened this has it
opened this

src/kernel/stamped.ts sits under explore, the map snapshot, home and the alarm lines, and no test names it. A wrong stamp check would serve stale pages everywhere at once.

Done when test/stamped.test.ts, using the now seam (no sleeps), shows:

  • [ ] Same key and stamp: compute runs once, hits counts the rest.
  • [ ] A new stamp recomputes and replaces the value.
  • [ ] At exactly maxAgeMs the entry is recomputed (the bound is strict), and just under it the entry is served.
  • [ ] Past maxEntries the least recently used key goes, not the least recently set: a hit re-inserts.
  • [ ] A compute that throws leaves no entry behind, and the next read computes again.
  • [ ] clear() empties it, and size follows every case.

If a case shows a bug, fix it in src/kernel/stamped.ts in the same pull and say which one.

Files: test/stamped.test.ts, src/kernel/stamped.ts

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs