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.
Step 1: Turn on Redis in cPanel
Section titled “Step 1: Turn on Redis in cPanel”- Log in to cPanel and open Redis under Software. (For Memcached, open Memcached instead.)
- Start the service if it isn’t running.
- 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
Section titled “Step 2: Connect LiteSpeed Cache”- In your WordPress dashboard, go to LiteSpeed Cache → Cache and open the Object tab.
- Set Object Cache to ON.
- Set Method to Redis (or Memcached).
- 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 and0as the port. - 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
Section titled “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
Section titled “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
Section titled “Related articles”Was this page helpful?
Thanks for your feedback.