PHP Child / A Request And Its Life

Doing the work again, or doing it once and remembering

The central economy of this half of the web is deciding what deserves to be recalculated.

Some answers must be fresh. A balance, a remaining seat count, anything the visitor is about to act on. Other answers change rarely and are asked for constantly: a list of categories, a page of standing information, an image that has not changed in a year. Rebuilding the second kind for every visitor is honest and wasteful. Building it once and handing out the saved copy is the single largest improvement available to most sites, and it usually costs less effort than any other change of comparable effect.

The catch is that a saved copy is a snapshot of a moment that has passed. The moment the underlying information changes, the copy becomes a lie, and it stays a lie until something clears it away. So the real work is not saving, which is easy. It is deciding how long a stale answer remains acceptable, and arranging for the copy to be discarded when it matters. Getting that wrong produces the classic complaint that the site is showing something the visitor knows is out of date.

There is a judgement to make and it is genuinely a judgement. A figure that may be a few minutes old is usually fine on a summary and unacceptable on a confirmation screen. The same information can therefore warrant different treatment on different pages. Beginners often look for a single correct setting. There is not one. There is only a question, asked per piece of information: how wrong is it acceptable to be here, and for how long.