Non-persistent cache groups

Some plugins don’t play nicely with a persistent WordPress object cache and either cause stale cache data, or straight up break functionality. Luckily it’s easy to exclude individual cache groups from being store in Redis.

Finding the group name

There are a dozen ways to find the cache group names, but the easiest two are using the Query Monitor plugin and searching the plugin’s codebase.

Using Query Monitor

One of the most convenient ways to see all cache groups used by the current page is opening up Query Monitor in the admin bar and going to Object Cache. Under Groups you’ll see a list of group names and how many keys they contain.

Search the codebase

One of the most reliable ways to find all cache groups of a plugin, is searching it’s codebase for wp_cache_get function calls. The second parameter passed to the function is the group name:

wp_cache_get('<key-name>', '<group-name>');

Excluding groups

Once you have identified the cache group name(s), you can mark them as non-persistent, so that they will only be cached for the duration of a request, but not persistently.

Use the non_persistent_groups configuration option in your WP_REDIS_CONFIG to exclude them:

define('WP_REDIS_CONFIG', [
    'non_persistent_groups' => [