The Redis is the type of cache solution for Persistent Object Cache for WordPress. It is only recommended solution for object cache. This type of cache stores data from database queries into a memory for fast access of data. It works so effectively with relational databases service like MySQL, MariaDB etc.
When WordPress page is loaded it perform database queries to retrieve information. It requires some time to perform database queries. By default Redis performed to store that database queries into a memory. So that the page load time slight deceases hence you will get fast page loading times. You need to follow all the details so carefully to integrate the Redis object cache on your WordPress instances.
Step-1 : Install the Redis packages
$ sudo apt install redis-server php-redis
Step-2 : Check that Redis is working or not
$ sudo redis-cli
Type the given command
This means Redis works.
exit to exit from Redis-cli.
Step-3 : Setup max memory and its rules for Redis
$ sudo vi /etc/redis/redis.conf
Find the given lines.
replace it with given parameter.
When all edit done then
:wq to save and exit.
Restart the services to make changes in effect.
$ sudo systemctl restart redis-server
Step-4 : Add Redis cache to WordPress configuration file
wp-config.php file and add these lines to the last of the file.
define( 'WP_CACHE', true ); define( 'WP_CACHE_KEY_SALT', 'techbrown.com' );
After that save and exit.
Step-5 : Enable Redis object cache to your WordPress
Finally you need to install the WordPress plugin – Redis Object Cache By Till Kruss to enable the Redis object cache. After installation of plugin now you are ready to use the flush cache option from above plugin settings. To enable the Redis on your website.
Congratulations now you have configured the Redis Object cache for WordPress CMS.