IVTEC Web solutions, made to fit

The cheapest cache is the work you do not repeat

Before you install Redis, ask how many times a day the data actually changes.

Illustration for The cheapest cache is the work you do not repeat

On a personal site, most content changes a few times a month. It is read thousands of times. Anything computed on every request is work paid for a thousand times and used once.

Three simple moves

Parse on write, not on read. Markdown becomes HTML when you press Save. The front end serves finished HTML.

Settings in a single file. All settings become a var_export written to disk. One include, zero queries, and OPcache already holds it compiled.

Sitemap and feed on disk. Regenerated hourly, not on every crawler visit.

What I did not do

I did not cache the article pages. They load in a few milliseconds, and the first time you add a caching layer you also add a whole class of bugs: stale content served with confidence.

A wrong cache is harder to debug than a slow page.

Related posts

1 min read

Image uploads without surprises

The extension means nothing, and the MIME type the browser sends means even less. What is left is re-encoding.