Valkey is an open-source NoSQL in-memory database that can work as an object caching solution for Content Management Systems (CMS) such as WordPress. Object caching stores database query results and delivers them faster the next time a user makes similar requests to the site. This caching boosts WordPress performance as the MySQL database response time commonly dictates how fast content gets served to the user.
Follow the steps in this article to boost your WordPress site performance with Vultr Managed Databases for Valkey.
Before you begin:
Valkey Object Cache is a persistent object cache plugin that stores data directly in an existing Valkey database. To use Valkey on WordPress, install and activate the plugin as described in the following steps.
Using a web browser, log in to your WordPress backend dashboard with your administrative user account.
On the left navigation bar, find and click Plugins.
On the Plugins page, click Add New.
Enter the keyword Redis® Object Cache in the Search Plugins bar.
In the search results, find Redis® Object Cache, and click Install Now.
When the installation is complete, click Activate to make the plugin ready.
To integrate the WordPress Redis® Object Cache plugin with your Vultr Managed Database for Valkey, you need to edit your site's wp-config.php file and add new configurations as described in this section.
Use SSH to access your WordPress server as a non-root user with sudo privileges. Replace 192.0.2.1 with your actual server's IP address.
Install the PHP Redis® extension.
For Ubuntu or Debian:
For CentOS or Rocky Linux:
Switch to your WordPress web root directory. Usually, /var/www/html or /var/www/public_html.
List files to verify that all WordPress files are available within the directory.
Back up the wp-config.php file.
Using a text editor of your choice, open and edit the wp-config.php file.
Add the following configurations at the top of the file just below <? php.
Edit all values to match your actual Vultr Managed Database for Valkey Cluster details. Below is what each of the configuration lines does:
Save and close the file.
In a web browser, open your WordPress dashboard.
Navigate to Settings, and click Valkey from the list of options.
Click Diagnostics and verify that your wp-config.php changes display in the log output as below.
Navigate to the Overview tab, and click Enable Object Cache to establish a connection to your Vultr Managed Database for Valkey.
When successful, the plugin status should change to Connected, and the connection information is displayed in the overview tab.
If the plugin status is Not Connected, navigate to Diagnostics for full details on why the connection fails.
To verify that your WordPress requests get cached to the Valkey database. Log in to your Valkey cluster.
Select the WordPress Valkey Database displayed in the plugin connection information. For this article, database 0.
View all keys.
All WordPress request results get cached to the Valkey database and flushed each time you make changes to the website.
Depending on your configuration, the Redis® Object Cache plugin may return errors on the Diagnostics page. Below is how you can fix them to connect successfully.
If you encounter this error:
tls connection scheme in your wp-config.php file.If you encounter this error:
wp-config.php configurations are above any other file configurations just below the <? php declaration.If you encounter this error:
wp-config.php file.You have successfully integrated your WordPress site to a Vultr Managed Database for Valkey cluster. Your website performance will improve as users make requests and MySQL database results get cached to your Valkey database.
0 Comments
Be the first to comment and share your perspective with the community.