By Daniel Bachhuber February 11, 2016
WP Redis is an object cache drop-in which lets you use Redis as a persistent storage backend. WP Redis v0.3.0, released today, brings you enhanced support for cache groups. For an introduction to object caching, and how persistent object caches can speed up your site, take a read through the WordPress at Scale article.
Bring Forth the Awesome
Why do cache groups matter? Because expiring caches is a famously "hard problem". As a developer, there are a lot of cases where you'd like to purge a group of cached values. However, most persistent object cache drop-ins, including WP Redis prior to v0.3.0, store object cache values in a lossy manner by concatenating
Enable native cache groups by upgrading to WP-Redis v0.3.0 and adding
An Example
Keeping track of the fruit in your refrigerator using the WordPress object cache? With native cache groups enabled, after you've returned from the grocery store, you can empty your memory with
That's an abstract example, but it's not hard to think of practical use-cases. For instance, purging all the object cache that relates to a specific plugin, or section of a website. Or, purging the object cache for a specific user when a certain action is taken by them. These can be very difficult to manage without being able to leverage cache groups.
These kinds of scenarios become most pressing when running WordPress at scale—e.g. when "just flush the whole cache" isn't a great answer. This is also when you need a high performance persistent object cache, so we're glad to bring Redis's unique capabilities to answer the call.
How do cache groups work? You might already know we use Redis's native hash data type to maintain this structured representation of the cache.
Supercharge your persistent object cache. Download WP Redis v0.3.0 from WordPress.org. Once you've built something awesome, file a Github issue with questions, feature requests, or comments.
Topics: Development, Website Technology, WordPress