08Website know-how & errors
Understanding caching – clear browser, Redis, DNS and Cloudflare
Why you still see the old page after a change at Nexthosting – which caches exist (browser, page cache, Redis, DNS, Cloudflare) and how to clear each one.
In short
A cache is a temporary store that remembers answers so everything goes faster. The catch: after a change, the old version may still be sitting somewhere. Between the server and your screen there can be up to five caches. Clear them from the inside out: WordPress and server, then CDN, then DNS and finally the browser.
Why caches exist
Section titled “Why caches exist”Building a page takes work: PHP runs, the database is queried, images are loaded. Delivering a finished copy saves time and computing power. That is why there are several temporary stores one after another.
- Browser cacheYour device remembers files
- DNS cacheAddress of the domain remembered
- CDN or proxye.g. Cloudflare
- Page cache on the serverFinished HTML
- Object cache (Redis)Database results
- PHP and databaseThe "real" page
The caches at a glance
Section titled “The caches at a glance”| Cache | Where? | What is remembered? | Typical problem |
|---|---|---|---|
| Browser | Your device | Images, CSS, scripts, whole pages | Old version after a change |
| DNS | Computer, router, resolver | Address of a domain (TTL) | Old page after a move |
| CDN/proxy (e.g. Cloudflare) | Third-party servers | Files, possibly pages | Old files, 52x errors |
| Page cache | Server or plugin | Finished HTML pages | Changes appear with a delay |
| Object cache (Redis) | Server | Database queries | Old settings or menus |
| OPcache | Server (PHP) | Compiled PHP code | A changed PHP file does not take effect immediately |
Clear the browser cache
Section titled “Clear the browser cache”A quick test without deleting anything: a private window (Ctrl+Shift+N or Ctrl+Shift+P) or another browser.
- Windows and Linux: Ctrl+F5 or Ctrl+Shift+R
- macOS: Cmd+Shift+R
This reloads the page without stored files.
- Chrome, Edge: Ctrl+Shift+Delete, choose a time range, tick “Cached images and files”, delete.
- Firefox: Ctrl+Shift+Delete, tick “Cache”.
- Safari: Settings, Advanced, “Show Develop menu”, then Develop, Empty Caches.
Press F12, open the Network tab and tick Disable cache. As long as the window stays open, nothing is loaded from the cache.
With the browser cache, the server decides with headers how long it applies (Cache-Control, Expires). An example of how to set this up is in .htaccess basics. The status code 304 Not Modified means: the browser asked whether anything had changed and used its stored copy (HTTP status codes).
Page cache and object cache
Section titled “Page cache and object cache”Page cache (WordPress and others)
Section titled “Page cache (WordPress and others)”A cache plugin or a server feature stores finished pages. After a change the cache has to be cleared; often this happens automatically on saving. Otherwise:
- In WordPress, open the menu of your cache plugin.
- Click Clear cache (depending on the plugin “Purge All” or similar).
- Also clear the minify/CSS cache if styles do not appear.
- Reload the page in a private window.
Use one cache plugin, not several at once.
Object cache (Redis)
Section titled “Object cache (Redis)”The object cache remembers the results of database queries. Nexthosting WordPress hosting includes Redis in every plan; with web hosting it is available from the Pro plan. It speeds up dynamic pages but can deliver old values, such as menus or settings.
- Clear it through the Redis plugin in WordPress (“Flush Cache” button).
- Via SSH with WP-CLI:
wp cache flushOPcache
Section titled “OPcache”PHP stores compiled code. The server usually detects new files by itself after a short time. If a changed PHP file stubbornly has no effect, a PHP restart in the web panel (if offered) or a note to support helps.
DNS cache and TTL
Section titled “DNS cache and TTL”DNS answers are remembered for as long as the TTL allows. After a move, some visitors therefore still see the old page.
- Before the changeLower the TTLe.g. to 300 seconds
- ChangeSet the new record
- Until the TTLMixed phaseOld and new answers
- AfterwardsEveryone sees the new pageRaise the TTL again
Clear the local DNS cache:
ipconfig /flushdnssudo dscacheutil -flushcache; sudo killall -HUP mDNSRespondersudo resolvectl flush-cachesMore in DNS basics and Solving DNS problems.
Cloudflare
Section titled “Cloudflare”If your domain uses Cloudflare as an intermediary, there is another cache there.
- Log in to Cloudflare and choose your domain.
- Open Caching, then Configuration.
- Choose Purge Everything or purge individual addresses (Custom Purge).
- During development you can switch on Development Mode: the cache is bypassed for three hours.
Also check the SSL mode (recommended: “Full” or “Full (strict)”), otherwise redirect loops threaten. Errors 520 to 526 come from Cloudflare (HTTP status codes).
Check the cache
Section titled “Check the cache”With curl you can see headers that point to a cache:
curl -sI https://meinprojekt.de/ | grep -iE "cache|age|etag|last-modified|cf-cache-status"| Header | Meaning |
|---|---|
cache-control |
How long may it be stored? |
age |
For how many seconds has the response been in the cache? |
etag, last-modified |
Version markers so the browser can check back |
cf-cache-status: HIT |
Cloudflare delivered from its cache (MISS = fetched fresh) |
Order of clearing
Section titled “Order of clearing”- Clear the WordPress cache plugin and the object cache.
- If present: clear Cloudflare or another CDN.
- Clear the browser cache or use a private window.
- For moves: clear the DNS cache and wait out the TTL.
Frequently asked questions
Section titled “Frequently asked questions”Should I always switch the cache off?
Section titled “Should I always switch the cache off?”No. Without a cache the site gets slower. Only switch it off for testing or clear it selectively.
Why do I see changes in the admin area but not on the site?
Section titled “Why do I see changes in the admin area but not on the site?”Usually the page cache or the CDN sits in between. Clear both.
Does this apply to game servers too?
Section titled “Does this apply to game servers too?”Game servers do not use web caches. With server pages and banners, however, the browser can show old images.