Skip to content

Installing Redis Object Cache for WordPress using Server Avatar

Redis Object cache for WordPress can be a nice power up add on to boost performances on WordPress.

Let’s go back to fundamentals : CACHING

Redis Object Cache refers to the use of Redis as an object caching system. In the context of web applications, object caching involves storing database query results so that the next time the same result is needed, it can be retrieved from the cache instead of being processed by the database again.

The idea is to keep these results in memory (which is much faster to access than disk-based databases) to improve performance and reduce the load on the database for frequently accessed data. When configured as an object cache, Redis stores data as key-value pairs and allows applications to quickly retrieve objects by their keys.

WordPress users, for example, might be familiar with Redis Object Cache as a plugin that can be used to cache WordPress data objects with Redis, thereby speeding up the website by reducing the number of database queries.

Instead of running the query over and over, those are being saved and served by the cached memory, speeding up the loading of the pages. Since Redis is open-source and it’s pretty new and updated, it’s a great choice to test.

As a general rule of thumb we should always avoid to have the same caching system in place by using multiple plugins that do the same. Redis is installed natively and running on most VPS systems so it’s worth to check how to enable and make it work for your wordpress site too.

Once you have it in place and working i strongly suggest to compare the queries by installing https://wordpress.org/plugins/query-monitor/ and see the results.

There won’t be a dramatic speed increase, but if you have a lot of queries, then the difference could be visible.

Find below the step by step install guide on Server Avatar for WordPress.

If you’re new to VPS hosting and management then it’s worth a read on my article dedicated to Server Avatar, you will learn why i suggest to use it and how this can make a massive difference in scaling your business if you do web development.

Default Redis Installation: Redis comes pre-installed with your Server Avatar setup by default. Just verify that the service is Running.

Verification:Access the Server Avatar panel.Navigate to settings and confirm the Redis service is enabled.

Retrieve Redis Password: In the Security Settings under your server name, locate the Redis password.Ensure to copy this password as it is required for the WP config file.

Edit WP Config File: Open the WP config file situated in your website’s root directory. Paste the Redis password into the designated field.Optionally, assign a Redis prefix, such as your website name or a specific combination of data.

Placement of Commands in WP Config: Insert the provided commands into the WP config file.Emphasize the correct placement of the Redis password.

Configuration Location:T he optimal position for these commands is indicated at the beginning of the WP config file.

Check Redis Object Cache Status: Inspect the Redis Object Cache status in Server Avatar settings.Despite a working status, the presenter disconnects, recommending a cache flush.

Final Steps: Following the installation and data input, initial indications may show file system readability and reachable Redis, but not connected.Activation should resolve this, and it is advisable to perform a cache flush.