# Enable Redis object caching
Source: https://docs.webgee.com/en/performance/redis-object-caching-lscache













Turn on Redis object caching for a WordPress site running LiteSpeed Cache.
Applies to shared and reseller hosting.

Object caching keeps the results of database queries in memory, so WordPress
stops asking the database the same questions on every page load. It makes the
biggest difference on sites with a lot of plugins, a large product catalogue, or
a slow admin area.

<Callout type="info">
  Memcached is no longer available. The extension was deprecated and disabled
  across the platform, so Redis is the supported option — see
  [Memcached vs Redis](/en/performance/memcached-vs-redis-which-is-best-for-my-website).
</Callout>

## 1. Enable Redis in cPanel [#1-enable-redis-in-cpanel]

1. In cPanel, open **Redis**.

   <img alt="The Redis entry in the cPanel tools list" src="__img0" />

2. Select **Enable Redis**.

   <img alt="The Redis Manager page with the enable control" src="__img1" />

3. Note the **port** and **password** shown. You need both in step 3.

   <img alt="The Redis connection details, showing port and password" src="__img2" />

You can return to this page at any time to see these values again.

## 2. Enable the PHP extension [#2-enable-the-php-extension]

Redis is running, but PHP cannot talk to it until the extension is on.

1. In cPanel, open **Select PHP Version**.
2. Select **Extensions**.
3. Tick **redis**.

   <img alt="The PHP extensions list with redis selected" src="__img3" />

The change applies immediately.

## 3. Point LiteSpeed Cache at Redis [#3-point-litespeed-cache-at-redis]

1. In WordPress, go to **LiteSpeed Cache → Cache → Object**.

   <img alt="The LiteSpeed Cache object cache settings" src="__img4" />

2. Set the following:

   | Setting      | Value                    |
   | ------------ | ------------------------ |
   | Object Cache | `On`                     |
   | Method       | `Redis`                  |
   | Host         | `127.0.0.1`              |
   | Port         | the port from step 1     |
   | Username     | leave empty              |
   | Password     | the password from step 1 |

3. Select **Save**.

## Check it worked [#check-it-worked]

On the same **Cache → Object** page, LiteSpeed shows a connection status. It
should read **Passed**.

If it does not, work through these in order:

* **Connection refused** — Redis is not running. Re-check step 1.
* **Class 'Redis' not found** — the PHP extension is off. Re-check step 2.
* **Authentication failed** — the password is wrong. Copy it again from
  **cPanel → Redis**; it is regenerated when Redis is disabled and re-enabled.

## If your site later shows an OOM error [#if-your-site-later-shows-an-oom-error]

Redis has a memory ceiling per account. When a site outgrows it you will see
`OOM command not allowed when used memory > 'maxmemory'`. See
[Redis memory limits](/en/performance/redis-limits-php-fatal-error-uncaught-redisexception-oom-command-not-allowed-whe).

## Related [#related]

* [Use Redis object caching without LSCache](/en/hosting/wordpress/how-to-configure-wordpress-to-use-redis)
* [Configure WordPress to use Redis](/en/hosting/wordpress/how-to-configure-wordpress-to-use-redis)
* [Memcached vs Redis](/en/performance/memcached-vs-redis-which-is-best-for-my-website)
