Using GridPane Redis Object Caching

3 min read

INFO

This article gives an overview of Redis Object Caching and how to use with Nginx. On Nginx, this type of caching is not controlled in any way by the toggle on the dashboard. The GridPane Redis Object Cache plugin allows you to enable and purge this cache.

Redis is an open source (BSD licensed) key value store that can operate as both an in-memory store and as cache. A data structure server in it’s own right, it can be easily paired with a relational database like MySQL to speed things up by caching database queries.

WordPress uses a MySQL database to cache internal application objects (breadcrumbs, menu items, etc.) which is generally an expensive process. Since the database also handles queries for page requests this can contribute to one of the most common bottlenecks in WordPress, often causing increased load-times.

When a user requests a WordPress page for the first time, a MySQL query is performed on the server. Redis caches this query, so when another user requests the same WordPress page, the results are provided from Redis without the need to query the database again.

If the query is not cached in Redis, the results are provided by MySQL, which are then added to the Redis cache. If a particular value is updated in the database, the corresponding Redis value is invalidated to prevent bad cache data from being served to the user.

All GridPane WordPress sites come deployed with all the server side wp-config.php configurations required to use Redis Object Caching for WordPress, and the necessary plugin already installed. To be able to use this caching is simply a matter of activating a plugin and enabling the caching.

Step 1. Activate the GridPane Redis Object Cache Plugin

Log in to your GridPane WordPress site and navigate to the Plugins page in WP Admin.

gridpane_redis_plugin.png

Activate the GridPane Redis Object Cache Plugin

gridpane_redis_activated.png

Step 2. Enable Redis Object Caching

Navigate to the GridPane Redis Object Cache Plugin Settings in Settings Redis

gridpane_redis_settings.png

Click the big green Enable Object Cache button.

In the Overview the Status will change to Connected and object caching will be enabled. The green enable button will be replaced by a green Flush Cache button and a red Disable Cache button. You will also receive a dismissible notification above the overview section.

gridpane_redis_settings_active.png

Step 3. Flush Redis Object Cache

To flush the object cache is easy, just click the big green Flush Cache button.

gridpane_redis_flush_cache_button.png

You will receive a dismissible notification, at the top of the settings page under the Plugin title, that the cache has been flushed.

gridpane_redis_cache_flushed.png

Step 4. Disable Redis Object Caching

To disable the object cache click the big red Disable Object Cache button.

gridpane_redis_disable_cache_button.png

You will receive a dismissible notification, above the overview sectionm that the cache has been disabled. The status in the overview section will change to Disabled.

gridpane_redis_disabled.png

What if I delete the Redis Object Cache plugin?

If you delete the object cache plugin, then all external redis based object caching is disconnected. WordPress does have its own internal PHP based object caching using the db and transients however, and this can be flushed using he GridPane Tools to clear the cache.

Currently GridPane uses a fork of the Till Kruss Redis Object Cache plugin. It is installed by default on all site builds, but if you happen to delete it you can download it from the github repo:

GridPane Redis Object Cache Github

However you can also use other Object cache plugins, two others that we can confirm work with GridPane are the original Till Kruss Redis Object Cache plugin, and the WP Redis Plugin.