Add support for caching HTML-rendered pages

Downside is that this consumes significant disk space, requires
recreating the entire cache when changing something to the way that
pages are rendered and removes flexibility to add dynamic
render-influencing settings in the future.

Alas, crawlers are getting more aggressive and I don't like the idea of
adding more invasive anti-bot tech.
This might not be enough in the long term, we also have a few slow SQL
queries that I'm not yet sure how to optimize. But this ought to give us
more time, at least.
This commit is contained in:
Yorhel 2025-05-25 14:41:00 +02:00
parent 8edb226a18
commit d3bebc8888
3 changed files with 64 additions and 5 deletions

View file

@ -14,9 +14,11 @@ CREATE TABLE contents (
-- encoding conversion and removing 0-bytes. This means taking sha1(content)
-- may not necessary match the hash, and it's possible for the same content
-- to be in the database under multiple hashes (but I suspect that's rare).
hash bytea NOT NULL UNIQUE,
content text NOT NULL
hash bytea NOT NULL UNIQUE,
content text NOT NULL,
html text
);
CREATE INDEX contents_nohtml ON contents (id) WHERE html IS NULL;
-- Unique man page, as identified by name & section