LocalWP does not come with Redis, nor does it have an add-on. This makes it impossible to use the Redis Object Cache plugin out of the box.
However, there is an easy way to set this up using Docker.
Once you have Docker installed on your system, run the following command:
docker run --name redis-local -p 6380:6379 -d redis
Code language: Shell Session (shell)
This command runs a Redis container named redis-local, mapping its default port (6379) to the host machine’s port (6380), and runs it in detached mode so that it continues running in the background.
The next step is to configure WordPress to connect to Redis. To do so, add the following lines to the wp-config.php
file of your WordPress installation:
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
Code language: PHP (php)
Follow the next steps to begin using Redis:
- Restart your website.
- Activate the Redis Object Cache plugin.
- Enable Object Cache from the Redis Settings page.
Leave a Reply