}
Memcached is also a popular cache choice.
However, at this point, Redis does everything Memcached can do, with a much larger feature set.
Data persistence is just one of the many examples.
The first time a WordPress page is loaded, a database query is performed on the server.
Redis remembers, or caches, this query. So, when another user loads the WordPress page, the results are provided from Redis and from memory without needing to query the database.
The Redis implementation used in this guide works as a persistent object cache for WordPress (no expiration).
An object cache works by caching the SQL queries in memory which are needed to load a WordPress page. When a page loads, the resulting SQL query results are provided from memory by Redis, so the query does not have to hit the database. The result is much faster page load times, and less server impact on database resources.
If a query is not available in Redis, the database provides the result and Redis adds the result to its cache. If a value is updated in the database (for example, a new post or page is created in WordPress) the Redis value for that query is invalidated to prevent bad cached data from being presented.
This article assumes you've already set up Redis in cPanel.
Redis and LiteSpeed:
If you are using the LiteSpeed cache plugin, then this is the recommended method of implementing Redis.
Login to the Admin Dashboard and go to: LiteSpeed Cache >> Settings >> Cache >> Object Cache >> and fill in your Redis details, as per your cPanel:
More information about the object caching is available here.
Redis and W3 Total Cache:
That's another way of integrating Redis into your WordPress, suitable if you are not using the LiteSpeed cache plugin.
Install it as any other WordPress plugin - Login to the Admin Dashboard >> Plugins >> Add New >> search for W3 Total Cache >> Install Now >> Activate.
Once you have W3 Total Cache installed, you'll see it named as Performance on the Admin Main Menu:
Click on General Settings and enable Database Cache and Object Cache, choosing Redis as Cache Method:
If you do not get Redis as an option, then most probably you haven't set up Redis in cPanel.
Under Performance, you'll see separate menus for Database Cache and Object Cache. That's where you'll need to configure the Redis hostname and database ID.
Select Database Cache then enter your Redis hostname / Your Redis socket address as it is appearing in your cPanel.
Use persistent connection should be enabled and Redis Database ID should be unique number dedicated for this cacheing type.
If you use WooCommerce, then you must add _wc_session_ to the "Ignored query stems" section.
Next stop is the Object Cache, where you'll need to enter the same Redis hostname / Your Redis socket address and unique Redis Database ID.
This is how to integrate Redis into WordPress. Feel free to contact us if you need further assistance.
Powered by WHMCompleteSolution