# Using Redis or Memcached object cache with WordPress

> Speed up busy WordPress sites and online stores by turning on Redis or Memcached in cPanel and connecting it to LiteSpeed Cache.

Source: https://helpcenter.ruachost.com/wordpress/guides/using-redis-or-memcached-object-cache-with-wordpress/

**Object cache** saves the results of database queries in memory, so WordPress doesn't ask the database the same questions on every page. It helps most where pages can't be fully cached, such as:

- WooCommerce stores (carts, checkout, account pages)
- membership sites and forums with logged-in users
- a slow WordPress dashboard

Ruachost hosting includes both **Redis** and **Memcached** in cPanel. You only need one. We recommend **Redis**.

> **Note:**
Turn on page caching first, with [LiteSpeed Cache](https://helpcenter.ruachost.com/wordpress/guides/installing-and-configuring-the-litespeed-cache-for-wordpress-plugin/). It makes the biggest difference. Object cache is the next step.

## Step 1: Turn on Redis in cPanel

1. Log in to cPanel and open **Redis** under **Software**. (For Memcached, open **Memcached** instead.)
2. Start the service if it isn't running.
3. Note the **connection details** shown: a host or socket path, and a port.

Also make sure the PHP extension is on: in cPanel, open **Select PHP Version → Extensions** and tick **redis** (or **memcached**).

## Step 2: Connect LiteSpeed Cache

1. In your WordPress dashboard, go to **LiteSpeed Cache → Cache** and open the **Object** tab.
2. Set **Object Cache** to **ON**.
3. Set **Method** to **Redis** (or **Memcached**).
4. Enter the **Host** and **Port** from Step 1. If cPanel shows a socket path (it ends in `.sock`), enter the full path as the host and `0` as the port.
5. Click **Save Changes**.

At the top of the Object tab, **Connection Test** should show **Passed**. If it fails, check the details and that the PHP extension is on.

## Check it's working

Browse a few pages of your site, then reload the **Object** tab. The status shows the cache is in use. Your WordPress dashboard and store pages should feel faster.

## If something goes wrong

- **Site shows errors or old data after turning it on:** go to **LiteSpeed Cache → Toolbox** and click **Purge All**, or set Object Cache back to **OFF**.
- **Can't reach the dashboard:** in cPanel's File Manager, delete the file `wp-content/object-cache.php`. This turns object cache off immediately.
- **Moving the site:** turn object cache off before moving, and on again afterwards, because the connection details are different on each server.

## Related articles

- [Why is my website slow?](https://helpcenter.ruachost.com/getting-started/website-troubleshooting/why-is-my-website-slow/)
- [Enabling the Redis extension for PHP](https://helpcenter.ruachost.com/apps/guides/enabling-the-redis-extension-for-php/)
