A cache is a stored copy of something that was expensive to produce, kept so the next request can be answered instantly. Websites use several layers of cache, each saving a different kind of work.
| Layer | Stores | Saves |
|---|---|---|
| Browser cache | Images, styles and scripts on the visitor’s device | Downloading files again |
| CDN | Copies of files or pages near the visitor | Distance and load on your server |
| Page cache | Finished HTML pages on your server | Running PHP and database queries |
| Object cache | Results of database queries, in memory | Repeating the same query |
| Opcode cache | Compiled PHP code | Re-reading and compiling PHP files |
Browser cache
Your server tells browsers how long to keep files with headers like Cache-Control: max-age=2592000 (30 days). Repeat visitors then load your images and styles from their own disk. Change a file’s name or add a version, such as style.css?ver=2, when you update it, so browsers fetch the new one.
Page cache
The biggest win for most sites. The first visitor to a page triggers the full work; the result is saved as a static file, and later visitors get that file. On WordPress this is done by a caching plugin or by the web server (for example Nginx’s FastCGI cache). See how much RAM a site needs for why this matters.
Object cache
A store in memory, such as Redis or Memcached, that keeps the results of database queries. It helps pages that cannot be fully cached, like shop carts and account pages.
Opcode cache
PHP’s OPcache keeps compiled code in memory. It is built into PHP and should always be on.
When caching causes problems
- You see an old version after an edit: clear the page cache or the CDN.
- One visitor sees another’s data: a page meant for logged-in users was cached. Never page-cache carts, checkouts or account pages.
- Changes do not show for everyone: different layers expire at different times. Clear from the top down: page cache, then CDN, then browser.
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.

