# Best xSpeed Cache Settings for a Blog vs a WooCommerce Store on xCloud

> Which xSpeed Cache values to use on xCloud for a blog and for a WooCommerce store: cache expiry, checkout-safe JavaScript delay, product image and cleanup.

The best xSpeed Cache settings depend on the kind of site. A **blog** can cache pages for a week and delay almost every script. A **WooCommerce store** needs a 24-hour cache expiry, a list of checkout scripts that are never delayed, a rule that preloads the product photo, and Minify JavaScript off until you've placed a test order.

This guide gives the values to use, where to set each one, and what to check afterwards. These values were checked on xSpeed Cache 1.4.10. Labels may differ slightly in later versions. To switch xSpeed on in the first place, see [How to Configure xSpeed Cache Settings on xCloud WordPress](/docs/configure-xspeed-cache-settings-xcloud/). For the full list of settings, see the xSpeed team's [recommended settings](https://xspeedcache.com/docs/recommended-settings/) page.

## The settings at a glance

xCloud installs xSpeed with page caching and object caching on. The other speed settings start off, so nothing changes on your site until you choose it. Set them in **WordPress admin → xSpeed Cache → Settings**.

| Setting | Where in xSpeed | Blog | WooCommerce store |
|---|---|---|---|
| Cache expiry (hours) | Cache → Page Cache | 168 (the default) | 24 |
| Separate mobile cache | Cache → Page Cache | Off | Off |
| Cache pages for shoppers with a cart | Cache → Page Cache | Off | Off |
| Enable browser cache headers | Cache → Browser Cache | On | On |
| Enable Gzip compression | Optimization → Compression | On | On |
| Object cache | Cache → Object Cache | On (Redis, connected by xCloud) | On (Redis, connected by xCloud) |
| Enable preloader, Schedule | Cache → Preloader | On, Daily | On, Daily |
| Minify HTML, Minify CSS | Optimization → CSS & JavaScript | On | On |
| Minify JavaScript | Optimization → CSS & JavaScript | On, after a check | Off until a test order passes |
| Combine CSS / JavaScript | Optimization → CSS & JavaScript | Off | Off |
| Defer JavaScript, Delay JavaScript | Optimization → CSS & JavaScript | On | On, with the store exclusions below |
| Load CSS without blocking | Optimization → CSS & JavaScript | Off (needs Critical CSS, Pro) | Off (needs Critical CSS, Pro) |
| Lazy-load images, embeds and your own videos | Optimization → Media Optimization | On | On |
| Images to load right away | Optimization → Media Optimization | 1 | 1 |
| Enable resource hints, Preload the main image | Optimization → Resource Hints | On | On |
| Main image rules | Optimization → Resource Hints | Leave empty | `post_type:product \| featured` |
| Automatic cleanup | Tools → Database | Weekly | Weekly |
| Heartbeat | Optimization → Heartbeat | Defaults | Defaults |

## Step 1: Leave xCloud's own caches off

xSpeed Cache does page caching and object caching itself, so xCloud's built-in **Full Page Caching** and **Redis Object Caching** stay off. Running two page caches at once can show visitors old pages, and WordPress can only use one object cache at a time.

When you create a site, open **Configuration → Performance** in the new site form. **xSpeed Cache** is on and marked **Recommended**, and the two xCloud switches below it are off.

![The Performance section of the new site form, with xSpeed Cache switched on and Full Page Caching and Redis Object Caching off](/_landing/docs/best-xspeed-cache-settings-xcloud-image-1.png)

On a live site, open **Sites → your site → WordPress → Caching**. On an Nginx server, **Page Caching** is on with **xSpeed Cache** selected as the provider.

![The site's Caching tab in xCloud with xSpeed Cache selected under Page Caching](/_landing/docs/best-xspeed-cache-settings-xcloud-image-2.png)

Further down, **Redis Object Cache** is off, with the note "xSpeed Cache already handles object caching for this site, so Redis Object Cache is not needed alongside it." Leave it off. The Redis server keeps running, and xCloud connects xSpeed's object cache to it, so the Redis user and password still show on this page.

![The Redis Object Cache switch turned off on the Caching tab, with the note that xSpeed Cache already handles object caching](/_landing/docs/best-xspeed-cache-settings-xcloud-image-3.png)

## Step 2: Set the page cache expiry

In **xSpeed Cache → Settings → Cache → Page Cache**, set **Cache expiry (hours)**:

- **WooCommerce store: 24.** According to the xSpeed team's recommended settings, a price, stock or stock-status change clears the product page (the parent product for a variation), the Shop page, its category and tag archives and a static front page, and saving a product in wp-admin clears the whole site. The 24-hour expiry covers changes made outside WooCommerce, such as prices synced from another system, so an old page is never shown for more than a day. If those syncs run several times a day, go shorter. The test order in Step 6 checks that a new price shows straight away.
- **Blog: 168**, the default. Posts change less often, so a week is fine.

![Cache expiry (hours) set to 24 on the Page Cache screen of a WooCommerce store](/_landing/docs/best-xspeed-cache-settings-xcloud-image-4.png)

![Cache expiry (hours) left at 168, one week, on the Page Cache screen of a blog](/_landing/docs/best-xspeed-cache-settings-xcloud-image-11.png)

On the same screen, leave **Separate mobile cache** and **Cache pages for shoppers with a cart** off. A responsive theme sends phones the same page, so one cached copy is right. On Nginx, a separate mobile cache also stops xSpeed serving cached pages straight from disk, so cached pages load more slowly. Turn it on only if your theme really shows phones a different page.

![Separate mobile cache and Cache pages for shoppers with a cart both off on the Page Cache screen](/_landing/docs/best-xspeed-cache-settings-xcloud-image-5.png)

On our test store, the cart, checkout and account pages were never served from cache, and a second visit to the Shop page loaded straight from the server's cache. To check it yourself, open the page in a private window and look at the page's response details in your browser's developer tools: a cached page says HIT, an uncached one says BYPASS.

## Step 3: Delay JavaScript, but never the checkout scripts

Open **Optimization → CSS & JavaScript**. Turn on **Minify HTML**, **Minify CSS**, **Defer JavaScript** and **Delay JavaScript** on both kinds of site. Leave **Combine CSS** and **Combine JavaScript** off. On a store, leave **Minify JavaScript** off until you've placed a test order (Step 6); on a blog, turn it on and check your menus and forms.

![Defer JavaScript and Delay JavaScript turned on, Minify JavaScript and Load CSS without blocking off, on the CSS & JavaScript screen](/_landing/docs/best-xspeed-cache-settings-xcloud-image-7.png)

**Load CSS without blocking** only acts on pages that have Critical CSS, which is an xSpeed Pro feature. On the free plugin it does nothing, so leave it off. With Pro, turn on Critical CSS first, then this.

Delay JavaScript runs on cart and checkout pages too, and xSpeed only keeps jQuery and cookie consent banners out of it by default. On a store, paste these lines into **Scripts to never defer or delay**, one per line, below the two defaults:

```text
stripe
paypal
wc-add-to-cart
wc-add-to-cart-variation
wc-cart-fragments
wc-cart
wc-checkout
blocks/checkout-frontend
blocks/cart-frontend
blocks/mini-cart
recaptcha
challenges.cloudflare.com
```

Leave out a line for a plugin you don't use. For another payment gateway (Square, Mollie, Klarna, Razorpay), add part of its plugin folder name, such as `woocommerce-square`. xSpeed doesn't ship store-specific exclusions yet, so you add them yourself. This list comes from the xSpeed team's [recommended settings](https://xspeedcache.com/docs/recommended-settings/).

![The Scripts to never defer or delay box on a WooCommerce store, with jquery-core and jquery-migrate followed by the store exclusions](/_landing/docs/best-xspeed-cache-settings-xcloud-image-6.png)

A blog needs no list. If a menu, slider or form stops working, add that script's name or address to the same box.

## Step 4: Load the main product image first

With the settings below, xSpeed loads the first image on each page straight away and preloads it. On a product page, the first image is not always the product photo, so tell xSpeed which one it is.

1. Open **Optimization → Media Optimization**. Turn on **Lazy-load images**, **Lazy-load embeds** and **Lazy-load your own videos**, and keep **Images to load right away** at **1**, so the gallery thumbnails below the photo still lazy-load.

![Images to load right away set to 1 on the Media Optimization screen](/_landing/docs/best-xspeed-cache-settings-xcloud-image-9.png)

2. Open **Optimization → Resource Hints** and turn on **Enable resource hints** and **Preload the main image** (both start off on a site where xCloud installed xSpeed). On a store, add this line to **Main image rules**: `post_type:product | featured`. `featured` is the product image you set in WooCommerce. A blog can leave the box empty.

![post_type:product | featured entered in Main image rules on the Resource Hints screen](/_landing/docs/best-xspeed-cache-settings-xcloud-image-8.png)

Open a product page in a private window, view the page source and search for preload. The first image listed should be the product photo. On our test store it did.

## Step 5: Schedule the database cleanup

Open **Tools → Database**:

1. Set **Automatic cleanup** to **Weekly**. It starts on **Manual**, and the choices are Manual, Hourly, Daily and Weekly. A quiet blog can stay on Manual and clean by hand once a month.
2. Under **What to clean automatically**, tick **Expired Transients**, **Spam Comments**, **Orphan Post Meta** and **Orphan Comment Meta**. A schedule cleans nothing until you tick items. Review revisions and trashed content by hand instead of cleaning them automatically.

![Automatic cleanup set to Weekly, with Spam Comments, Expired Transients, Orphan Post Meta and Orphan Comment Meta ticked on the Database screen](/_landing/docs/best-xspeed-cache-settings-xcloud-image-10.png)

The xSpeed team's recommended settings note that the cleanup doesn't yet include WooCommerce's own tables: expired customer sessions and the scheduled actions history in **WooCommerce → Status → Scheduled Actions**. WooCommerce clears both itself on its own schedule.

## Step 6: Check the store's location setting, then place a test order

In **WooCommerce → Settings → General**, check **Default customer location**:

- **Shop country/region** or **No location by default**: everyone sees the same prices. Use one of these unless your prices change by country.
- **Geolocate**: don't use it with any page cache. The first visitor's prices are cached and shown to everyone.
- **Geolocate (with page caching support)**: WooCommerce adds a `?v=` code to each address, and the xSpeed team's recommended settings say xSpeed doesn't cache those addresses today, so most of the store is served uncached. Use **Shop country/region** unless your prices change by country.

Then place a test order in a private window and check each of these:

1. Add a simple product and a product with variations. Pick the options, and the **Add to cart** button works.
2. The mini-cart and cart count update without a page reload.
3. The cart page shows the right items and totals, and coupons apply.
4. On checkout, the address fields, shipping options and payment form load, and the reCAPTCHA or Turnstile check shows if you use one.
5. The order goes through and the thank-you page appears.
6. Change a product's price or stock in wp-admin, then reload its product page and the Shop page. The new value shows.

If something breaks, find the script in your browser's developer tools and add its name to **Scripts to never defer or delay**. When the order works, you can try **Minify JavaScript** on the store and run the test order again.

## On OpenLiteSpeed servers

The values above are the same on OpenLiteSpeed. The xCloud side looks different:

- The new site form shows **LiteSpeed Cache** instead of Full Page Caching, and there is no Redis Object Caching switch.
- xSpeed manages its own server rules, so there is no **Re-sync Nginx Configuration** button.
- On OpenLiteSpeed, turning on **Separate mobile cache** doesn't slow cached pages down.

On an Nginx server, click **Re-sync Nginx Configuration** on the site's Caching tab after you change xSpeed's exclusion settings (excluded URLs, cookies or query parameters), so the server rules match. The settings in this guide don't need a re-sync.

For how xCloud's own page and object caches work, see [How Caching Works in xCloud](/docs/how-caching-works-in-xcloud/).

## Frequently asked questions

### Should I turn on Full Page Caching or Redis Object Caching in xCloud as well as xSpeed Cache?

No. xSpeed Cache already does page caching and object caching, so xCloud keeps Full Page Caching and Redis Object Caching off while xSpeed is the site's cache. The Redis server itself keeps running, and xCloud connects xSpeed's object cache to it.

### Why does a WooCommerce store use a 24-hour cache expiry instead of 168 hours?

Store prices and stock change more often than blog posts, and some changes, such as prices synced from outside WooCommerce, may not clear the cache. A 24-hour expiry means an old page is never shown for more than a day. A blog can keep 168 hours. The test order in this guide checks that a new price shows straight away.

### Do I need xSpeed Pro for these settings?

No. Every value in this guide works on the free plugin except Load CSS without blocking, which only acts on pages that have Critical CSS, an xSpeed Pro feature. On the free plugin, leave it off.

### Does xSpeed Cache handle WooCommerce cart fragments?

Not on its own yet. Add wc-cart-fragments to Scripts to never defer or delay so the mini-cart still updates, then check the cart count during your test order.

If you run into any issues with these settings, feel free to reach out to our [support team](/docs/access-built-in-support-portal-in-xcloud/).
