Object cache with Redis for WordPress on a VPS: what it speeds up and how to set it up

The short answer: an object cache keeps in memory the answers WordPress asks the database for, so it does not ask again. It helps where the page cache cannot reach: the dashboard, the shop, people who are logged in. You use Redis, which you install on a VPS where you have full access. It does not replace the page cache; it adds to it.

When it is worth it

Situation Does it help?
Presentation site, almost read-only Little. The page cache already solves it: LiteSpeed Cache.
Shop (WooCommerce) or members site Yes. Many pages cannot go in the page cache.
Slow dashboard, many plugins Yes, you usually notice it in the dashboard.
Server with no free memory No. Redis takes memory; fix that first: Out of memory on a VPS.
Shared hosting This is not where Redis is installed; you need a VPS where you can install services.

Installing it, step by step

1 Measure first: note the dashboard’s response time and that of an uncached page, to compare afterwards.
2 Install Redis on the VPS (Ubuntu or Debian): sudo apt install redis-server. Check it answers: redis-cli ping should say PONG.
3 Keep it local: in Redis’s configuration file the address should be 127.0.0.1 (the default). Set a memory limit (maxmemory) that fits your RAM and the allkeys-lru policy, so it discards the oldest instead of growing without end.
4 In WordPress, install the “Redis Object Cache” plugin and, if you have several sites on the same server, give each a different prefix in wp-config.php (WP_REDIS_PREFIX).
5 Enable it in the plugin (Settings > Redis > Enable Object Cache) and look at the status: it should say “Connected”. Measure again and compare.
Never open Redis’s port to the internet. By default it has no password and whoever gets there reads and deletes everything. Keep it on 127.0.0.1 and the port closed in the firewall: Keeping your VPS secure.
After changing the theme, after a lot of updates or if something looks “old”, flush the object cache in the plugin. And watch the memory: Seeing what uses CPU, memory and disk on your VPS.

Want help deciding whether Redis is worth it on your site? Open a ticket with the address and the VPS plan.

Open a support ticket

SEE ALSO

LiteSpeed Cache for WordPress: the first settings

Installing and tuning a page cache

The site is slow: what actually makes a difference

How to see what is using CPU, memory and disk on your VPS

Out of memory on a VPS: what the OOM killer is and what to do

RECOMMENDED PRODUCT

WordPress hosting

One-click install, updates handled, and speed that holds up. from $6.60/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?