Installing and tuning a page cache

Without a cache, every visit makes the server build the page again: query the database, run the PHP, assemble the HTML. With a cache, the finished page is handed over directly. It is the one change that usually halves response time, and it takes an afternoon.

Our servers run LiteSpeed, and that decides which plugin is the right one. LiteSpeed Cache stores pages inside the web server itself, before PHP starts. A generic caching plugin, such as WP Super Cache, stores files and still needs PHP to start in order to serve them. Here, the first is always faster.

The recommended route: LiteSpeed Cache

1 In the dashboard, Plugins › Add New, search for LiteSpeed Cache, install and activate.
2 Under Cache, switch caching on. The default options already give you most of the gain; you do not need to touch anything else to start.
3 Exclude the pages that differ per visitor. In a shop: cart, checkout and customer account. The plugin knows the shop pages and excludes them itself, but check.
4 If you moved the login address, exclude that too: changing the WordPress login address.
5 After any change to the site, use Purge All. If you edited a page and still see the old one, that is the cache doing its job.

And WP Super Cache?

It makes sense in two situations: if you already have it working and would rather not touch it, or if you brought the site from a server that was not LiteSpeed and want to change one thing at a time. It works perfectly well; it simply does not take advantage of the server it is on.

1 Install and activate. Under Settings › WP Super Cache, turn caching on and save.
2 Stay in simple mode. The rewrite-rule mode is faster and edits .htaccess: only use it if you know how to put that file back.
3 Set how long pages stay valid and turn on the automatic clear-out of old ones. Without it, the files pile up into the thousands.
4 Exclude the cart, account and login pages, and tell it not to store pages for signed-in users.
Never two caching plugins at once. The symptoms are hard to connect to the cause: stale pages that will not go away, logins that do not take, and, in a shop, one visitor’s cart showing up for another. Pick one and delete the other: deactivating is not enough, because many leave files and rules behind.

Proving it works

1 Open a private window and load a page. Close it, open another private window and load the same page. The second has to be visibly and immediately faster.
2 Press F12, Network tab, and look at the page’s response headers. A working cache leaves a line there saying the page was served from the cache.
3 Signed in, you should always see the fresh version. If you see somebody else’s content while authenticated, switch the cache off now and review the exclusions.

The cost nobody counts: the files

A page cache writes one file per page, and sometimes one per variant: phone, desktop, language. On a site with many pages that is thousands of small files, and the account’s file count is a real limit: the limits nobody advertises.

Turn the automatic clear-out on and keep an eye on the file counter in cPanel. If it jumped after you switched caching on, shorten how long pages stay valid.

What caching does not do

It does not fix What does
A slow admin dashboard It is never cached. The causes are in admin-ajax eating your resources.
A page that is slow in itself If it takes eight seconds to build, the first visit still takes eight. See the site is slow.
Heavy images The cache serves the page; it does not shrink the files. Images are dealt with separately.
A plan short on resources It helps, but it creates no resources. See what to measure before you change plan.
Careful with the same plugin’s aggressive options. Combining and minifying CSS and JavaScript, deferring everything, or preloading pages buy tenths of a second and break menus, forms and carts with great ease. Turn one on at a time and use the site properly after each.

Turned caching on and the site started showing the wrong pages?

Open a request

SEE ALSO

WordPress hosting

Hosting plans

Support Policy

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $10.00/mo

See plans
  • 0 Users Found This Useful
Was this answer helpful?