Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Caching layers

Every cache between a visitor and the database of an Exponential site, in order: what each holds, whether it ships on or off, where it lives, which server uses it, and how it is cleared, so a host knows what a plan…

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/hosting/performance/caching-layers.md

On this page

Caching layers

This page is for system administrators and support staff at hosting companies. It answers: which caches an Exponential site has, from the visitor's browser down to the database, which of them ship switched on, where each lives, which server uses it, and how each is cleared. With it, a host can decide what a plan switches on, and support can tell where a stale or slow page comes from.

Contents

  1. The layers at a glance
  2. In front of the server
  3. In the server, before the kernel
  4. Inside the kernel
  5. Under the kernel
  6. Which layers are shared between servers
  7. Reading the headers
  8. What a plan can switch on
  9. Checklist

The layers at a glance

#LayerShipsServesCleared by
1Browser cache of static filesVelocity: StaticMaxAge=31536000; Apache: your mod_expireseveryonefile names, or waiting out the lifetime
2Browser cache of pagesoff (site.ini [HTTPHeaderSettings] CustomHeader=disabled)anonymous visitors, when switched onlifetime
3CDN, caching proxy, or the page cache of LiteSpeed and OpenLiteSpeednot part of Exponential (LiteSpeed: a commented block in .htaccess_root)as you configure it; LiteSpeed: anonymous visitorsyour proxy; LiteSpeed: max-age; Exponential sends no purges
4Velocity response cacheon under Velocity (velocity.ini [CacheSettings] Enabled=enabled)anonymous visitorsexp:velocity cache clear
5Role-aware HTTP cacheoff (httpcache.ini [HttpCacheSettings] Enabled=disabled)anonymous and signed-in, per permission contextpurged on content change; --clear-id=exphttpcache
6Static cacheoff (site.ini [ContentSettings] StaticCache=disabled)anonymous visitors, as filesregenerated on publish
7Content view cacheon ([ContentSettings] ViewCaching=enabled)every visitorcontent change; --clear-tag=content
8Template-block cacheon ([TemplateSettings] TemplateCache=enabled)every visitorexpiry; --clear-id=template-block
9Compiled templates, INI and override cachesonevery request--clear-tag=template, --clear-tag=ini
10Redis or Valkey for views, blocks, INIonly with the sevenx_valkey_cache extensionevery requestthe extension's purges; its clear script
11SQL query cacheoff (querycache.ini [QueryCacheSettings] Mode=off)every request it can answerwrites to the tables read; --clear-id=querycache
12OPcache, APCuper PHP processevery requestreload or restart; Setup > Caches buttons

Sources: Caches, Chapter 10, section 10.6 and the pages linked below.

In front of the server

Browser. Velocity sends Cache-Control with a one-year lifetime for stylesheets, scripts and images ([ServerSettings] StaticMaxAge); a file replaced under the same name is not fetched again until it expires. Pages are sent no-cache unless [HTTPHeaderSettings] is switched on for anonymous visitors only. See HTTP cache headers. Under Velocity, an optional navigation cache (a service worker, /index.js and sw.js) can answer return visits in the visitor's own browser (The response cache, and getting out of the network's way).

CDN or proxy. Exponential sends no purge or ban requests to a proxy; a proxy that stores pages must be told what to store and for how long. See Varnish and reverse proxies and CDN.

The page cache of LiteSpeed and OpenLiteSpeed. On these servers the web server itself can keep pages: the commented block ## >>> LiteSpeed page cache of .htaccess_root (or the same rules in the virtual host) stores anonymous GET requests without query string, session or sign-in cookie for max-age seconds and answers them without PHP. Nothing purges it on publish; it expires. See Page caching with LiteSpeed and OpenLiteSpeed.

In the server, before the kernel

Velocity response cache. Keeps rendered anonymous pages in the parent process and answers repeat requests before a worker is chosen: no fork, no PHP, no database. Default lifetime 30 seconds, stale-while-revalidate 60 seconds; signed-in visitors are never served from it. See Velocity response cache.

Role-aware HTTP cache. Off by default. When on, it keeps whole content views per permission context (anonymous, a role context shared by users with the same roles, or a private context) and serves them before the kernel starts: under Apache or PHP-FPM through an early exit included from config.php, under Velocity from the server process. It purges on content change (ContentChangePurges=all by default). Measured on a reference installation, a signed-in page under Apache: 484 requests a second from the cache against 4.3 rendered (HTTP cache).

Static cache. Off by default, and the installation book says to leave it off: with it on, every publish regenerated every affected page over HTTP inside the editor's request. See Static cache.

Inside the kernel

CacheWhat it holdsSetting
Content view cachethe rendered content of each node viewsite.ini [ContentSettings] ViewCaching
Template-block cachecache-block fragments of templates[TemplateSettings] TemplateCache
Compiled templatestemplates compiled to PHP[TemplateSettings] TemplateCompile
INI, override, translation, design cachesmerged settings and lookupsalways on
Image aliasesresized images, made on first viewimage.ini

When a change would clear the view caches of [ContentSettings] CacheThreshold nodes or more (250 shipped), every view cache of the site is expired instead, and the log says "Expiring all view cache" (Caches, Usual questions).

With the sevenx_valkey_cache extension, the content view cache, template blocks and the compiled INI cache can live in Redis or Valkey instead of files. See Valkey and Redis.

Under the kernel

SQL query cache. Off by default. Mode=request removes repeated identical SELECTs within one request; Mode=shared keeps results across requests in APCu or files. Measured on a test installation under Apache with PHP-FPM, a rendered front page went from about 0.6 s to about 0.17 s with no statement sent to the database (SQL query cache). It works with the SQL drivers (1. SQLite 3, 2. PostgreSQL, 4. MariaDB, 5. Oracle through ezoracle, 6. MySQL); the 3. MongoDB driver does not use it. Writes made outside Exponential (a restore, a SQL client) are invisible to it: clear it after every restore.

OPcache and APCu belong to each PHP process tree. See OPcache and PHP-FPM tuning.

Which layers are shared between servers

The cache files are in var/, which Apache with PHP-FPM and Velocity share: clearing a cache in Setup > Caches reaches both. Two things do not (Caches):

  • Velocity keeps settings in memory: restart it after clearing the INI caches.
  • Velocity's response cache answers pages from its own store: clear it with exp:velocity cache clear.

APCu and OPcache are per process tree. On several web nodes, files in a shared var/ are shared; APCu is per server (the query cache's Storage=file exists for that case). See Several web nodes.

Reading the headers

HeaderSet byMeaning
X-Cache: HIT, STALEVelocity's response cacheanswered from the cache, or from an expired copy while a new one renders
AgeVelocity's response cacheseconds since the entry was stored
X-Exp-Cache: HIT, STALE, MISS (reason), BYPASS (reason)the role-aware HTTP cachewhat it did and why
curl -sI https://example.com/ | grep -iE 'x-cache|x-exp-cache|age|cache-control'

A page answered by Velocity's response cache also carries the X-Exp-Cache stored with it, often MISS from the render that filled both caches (HTTP cache, Seeing what it does).

What a plan can switch on

LayerPlan optionWatch
Velocity response cacheon with Velocity plansDefaultTtl is how stale an anonymous page may be
Role-aware HTTP cachean option for sites with many signed-in visitorssessions must be in files every server can read
SQL query cacherequest everywhere; shared with APCu sizedclear after restores
Redis or Valkeyan option where you run the serversize it, set an eviction policy
Page headers for browsers and CDNsan option for anonymous-heavy sitesOnlyForAnonymous=enabled always
Static cachenot recommendedpublish cost

Checklist

  • To do: The plan states which layers are on and who clears them.
  • To do: Support knows the headers above and the clearing order (Cache clearing and warming).
  • To do: Caches that hold rendered output are cleared only after new code runs.
  • To do: The query cache is cleared after every database restore.
  • To do: No proxy or CDN stores pages that depend on a session cookie.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x