Website Without PHP
US
Menu

Cache

Also known as: caching, page cache

A cache is a store of ready-made copies, such as finished pages, so a website or browser can show something instantly instead of building it again.

Static sites Last updated:

A cache is a store of ready-made copies, such as finished pages, so a website or browser can show something instantly instead of building it again. Showing a copy that already exists is much less work than creating it from scratch. That is why caching is one of the main tools for making dynamic sites feel fast, and also why it is behind so many cases of “I changed it but nothing happened”.

What is a cache?

Caching can happen at several places between your server and a visitor. The browser keeps copies of images and styles so a returning visitor does not download them again. A CDN keeps copies on servers near the visitor. Your server can keep a full page cache, a copy of the finished page that skips PHPPHP is a programming language that builds your web pages on the computer that hosts your site, just before they reach the visitor. WordPress runs on it. and the database. PHP itself can keep compiled code in memory, which is the job of OPcacheOPcache is a PHP feature that remembers your site's code in a ready-to-run form, so PHP does not have to prepare it again for every visitor..

Each layer has rules for how long a copy stays valid. When the time is up or you clear it, a new copy is created. If nothing tells a layer that the content changed, it may keep serving the old version until the time runs out.

What a cache means for your PHP site

On a WordPressWordPress is free software for building and editing a website in your browser. It is written in PHP, so it builds each page when someone visits. site, every uncached visit runs PHP and queries the database. A page cache saves a finished copy and serves it to the next visitors, which relieves the server. Caching plugins do this, and some hosts include it at the server level. Pages that depend on the visitor, such as a cart, an account or a checkout, must not be cached for others.

Caching also plays a part in upgrades. After a PHP or pluginA WordPress plugin is an add-on you install in WordPress to give your site extra features, such as contact forms, SEO tools or a webshop. change, old copies might hide a problem or keep showing the previous version. When you test an upgrade, clear the caches or test with caching off, so that you see what the new setup really does.

A CDNA CDN is a network of servers around the world that keeps copies of your website close to your visitors, so pages load fast wherever they are. adds another layer. If you change content and the CDN keeps its old copy, visitors see the old page even though your server has the new one. Know who can clear the CDN cache and how.

How to troubleshoot a stale page

Work from the visitor back to the server. Open the page in a private window to rule out your browser. Add a random query string to the address to bypass some caches. Check the response headers for hints about the cache status. Then clear the caching plugin, the host cache and the CDN cache one at a time, so you learn which layer held the old copy.

A static site and caching

A static websiteA static website is made of ready-made page files that the server hands over as they are, with no PHP code or database working behind the scenes. is built from finished files, so there is no page to build on request and nothing for a server-side page cache to do. Caching still happens in browsers and the CDN, and you control it through headers. The advantage is simplicity: the files you publish are the files that are served, with the cache lifetime you chose. This is part of what our WordPress to static site service sets up.

When to act

Act when changes do not appear, when a caching plugin conflicts with another plugin, or when you see private content shown to the wrong person. If a cache problem has left the site broken, our emergency help for a website down can step in.

Frequently asked questions

Why do I still see the old version of my page?

A cache somewhere is still serving a stored copy. It can be your browser, a caching plugin, your host or a CDN. Clear them one by one, starting with your browser, and check which layer holds the old copy.

Should I clear the cache after every change?

Only when a stored copy would otherwise stay outdated. Many setups clear the right copies automatically when you publish. If changes do not show, clear the page cache and any CDN cache.

Does a cache make a site faster?

Usually, because the server skips the work of building the page again. The size of the gain depends on your setup, so test your own pages before and after.

Can a cache show private data to the wrong person?

If it is set up badly, yes. Pages that are personal, such as carts and accounts, must be excluded from shared caches. Check this whenever you add or change caching.

Related pages

  1. Domain
  2. Check
  3. Result
  4. Report

Which PHP version does your site run?

Enter your domain. We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login. We keep the domain and the result, never your IP address.