Verbi uses two layers of caching to keep translation overhead off the critical path.
Translation Dictionary Cache
Every string Verbi translates is stored in a dictionary keyed by domain and language. When a page is requested, Verbi checks the dictionary first — only strings that haven't been seen before are sent to DeepL. Previously translated strings are assembled from cache instantly.
This means the translation cost is paid once per unique string, not once per page visit.
Edge Page Cache
Once a page is fully translated — meaning every string on the page is already in the translation dictionary — Verbi caches the complete HTML response at Cloudflare's edge. Subsequent requests for that page are served directly from the nearest edge location, with no origin fetch and no translation work.
TTLs:
- Edge cache — 5 minutes (
s-maxage=300) - Browser cache — 1 minute (
max-age=60) - Stale-while-revalidate — 60 seconds (browsers may serve a stale copy while revalidating in the background)
First Visit vs. Repeat Visits
The first time a translated page is requested, Verbi fetches your origin, extracts all text, translates any new strings via DeepL, assembles the page, and stores the result in the edge cache. This request takes longer than a cached one.
From the second request onward, the page is served from the edge cache — typically around 12ms regardless of where the visitor is located.
If a page has new strings that aren't yet in the dictionary (e.g. you published new content), Verbi translates those strings and serves the page — but doesn't cache it until the dictionary is fully up to date. The next request after the dictionary is updated will populate the edge cache again.
When the Cache Is Bypassed
Pages are not cached when they contain new untranslated strings — the response is served but not stored. Excluded paths are always proxied without translation or caching. Requests with a Cookie header are forwarded to origin and not cached.
To manually clear cached pages — for example after updating your site's content — see Cache Purging.
