Updated: 29 September 2026 · Applies to: Redis Object Cache 3.0 for WordPress, with Redis 7 and 8 or Valkey 8 on Ubuntu 24.04 and 26.04, Debian 13, AlmaLinux and Rocky Linux 9 and 10

WordPress runs many database queries on every page. A persistent object cache keeps the results in memory, so repeated queries are answered without MySQL. This helps most on dynamic sites: shops, membership sites, forums and busy admin areas. It needs three parts: an in-memory server (Redis or its open-source fork Valkey), the PHP extension that talks to it, and a WordPress plugin. We tested the server and PHP extension on AlmaLinux 10 with Valkey 8.0 and PHP 8.3.

1. Install the cache server

apt install redis-server                      # Ubuntu, Debian
systemctl enable --now redis-server

dnf install valkey                            # AlmaLinux, Rocky Linux 10 (and 9)
systemctl enable --now valkey

AlmaLinux and Rocky Linux 10 ship Valkey instead of Redis; it speaks the same protocol, and WordPress plugins work with it unchanged. Check that it answers: redis-cli ping (or valkey-cli ping) prints PONG.

By default the server listens only on 127.0.0.1. Keep it that way: never expose port 6379 to the internet.

2. Install the PHP extension

apt install php-redis                         # Ubuntu, Debian
dnf install php-pecl-redis6                   # AlmaLinux, Rocky Linux 10 (AppStream) and 9 (EPEL)
systemctl restart php-fpm                     # or php8.3-fpm, or apache2, depending on your setup

Check: php -m | grep redis. The EPEL package for version 9 matches its default PHP 8.0; if you run another PHP version, install the extension from the repository your PHP came from (for example Remi). On cPanel servers, install it for each PHP version in WHM under Module Installers > PHP PECL.

3. Limit the memory and set an eviction policy

A cache should never fill all the RAM. In /etc/redis/redis.conf (Ubuntu, Debian) or /etc/valkey/valkey.conf (AlmaLinux, Rocky Linux) set, for example:

maxmemory 256mb
maxmemory-policy allkeys-lru

With allkeys-lru, the least recently used entries are removed when the limit is reached. Restart the service afterwards.

4. Install and enable the WordPress plugin

  1. If several sites share one server, give each its own key prefix in wp-config.php, above the line /* That's all, stop editing! */:
    define( 'WP_REDIS_PREFIX', 'site1:' );
    The defaults (host 127.0.0.1, port 6379) need no settings. For another host or port, add WP_REDIS_HOST and WP_REDIS_PORT.
  2. In WordPress, go to Plugins > Add Plugin, search for Redis Object Cache (by Till Krüss), install and activate it.
  3. Go to Settings > Redis and click Enable Object Cache. The status should show Connected.

With WP-CLI the same is: wp plugin install redis-cache --activate, then wp redis enable and wp redis status.

Check that it helps

Run redis-cli info stats | grep keyspace (valkey-cli on AlmaLinux and Rocky Linux 10): keyspace_hits should grow much faster than keyspace_misses as visitors browse. A page cache (full HTML pages) is a separate thing; the object cache works alongside it and helps most on pages that cannot be fully cached, such as the cart or the admin area.

If you want this set up and tuned for you, you can hire an expert.

Official documentation: Redis Object Cache plugin and Valkey: key eviction.

Was this answer helpful? 0 Users Found This Useful (0 Votes)