Ensuring that Onyx cache is working

This guide explains how to check that caching is working correctly for your Onyx site. It includes checking if the LiteSpeed cache plugin is installed, that there are no other plugin conflicts and verifying your content is being served from cache.

LiteSpeed Cache plugin

The LiteSpeed Cache WordPress plugin is installed on all sites by default. You will see a banner in your sites dashboard if the cache plugin is not installed.

You can either use the Click here link in the banner or reinstall via Settings > Tools > Reinstall default plugins.

reinstall-default-plugins-onyx.png
Page Caching

Ensure the LiteSpeed Cache plugin is enabled, from with the WordPress dashboard:

Click LiteSpeed Cache on the left menu

View the General tab

Also check for a notice above this regarding cache conflicts. If there is a notification here regarding another plugin using advanced-cache.php, LiteSpeed Cache will not work. Some plugins that interfere with this include:

  • WP Rocket
  • WP Super Cache
  • WP Fastest Cache
  • W3 Total Cache

Such plugins should be disabled in favour of LiteSpeed Cache. Once done, Purge the cache (via the Plugin or Settings > Tools > Caching in the Onyx Portal) and ensure the conflict message is no longer there.

We strongly suggest removing any other caching or optimisation plugins. The LiteSpeed plugin is fully featured and can handle most requirements. It also includes Image Optimisation functionality, so any plugins that optimise images can also be removed.
Verifying

You can verify that cache is working using browser dev tools or the curl command line utility

This Krystal article explains how to access various browser developer tools - link opens in a new window. One you have the dev tool opened you'll need to switch to it's Network tab.

Reload the page in your browser - Ctrl + F5 on a PC or Command + R on a Mac.

Under the Response Headers section you'll see a key of x-lsadc-cache with the value of either hit or miss.

Hit means that the page is being served from cache.

You can also check other items (for example specific files like images or css/js files) - a Status of 304 means the file was served from cache..

Use curl -I https://example-domain.com  and check the x-lsadc-cache header. Make sure you're using the final URL otherwise you'll just see a 301/302 response for the redirect (from non-www to www for example)

Type this - replacing the site address with your own.

curl -I https://krystaldemo.onyx-sites.io         

You'll see a response similar to the following:

HTTP/2 200
x-powered-by: PHP/7.3.7
content-type: text/html; charset=UTF-8
etag: "7-1564169211;;;"
x-lsadc-cache: hit
date: Fri, 26 Jul 2019 19:40:44 GMT
server: LiteSpeed


How did we do?


Powered by HelpDocs (opens in a new tab)
© Krystal Hosting Ltd 2002–