Files
khosra/internal
Claude Opus 5andbdeshi 6447a995d1 bound the picture memo, evicting the least recently used
The memo held one entry per picture ever rendered, for the life of the process.
Correct for one author's laptop, wrong for what this engine is meant to be: a
server that runs for months and serves a whole site to many readers.

Least-recently-used rather than clearing when full, because a site has pages
nobody opens for months and a front page opened every minute — discarding
wholesale throws away exactly the entries about to be asked for again. A map
into a recency-ordered list: reads promote, evictions take the back, both
constant time.

1024 entries is a few hundred kilobytes. Generous enough that a normal site
never evicts, bounded enough that no site can grow the process without limit.
The number is a constant and not a setting, because a knob with one user is a
knob nobody asked for.

Eviction, replacement and the bound are tested, including under -race, since
requests are concurrent and the store is shared.

Latent item cleared. ext 1975/2000.
2026-08-01 23:50:53 +06:00
..