This is the most widely used article online – it can solve 80% of Redis-related issues!

Of course, an additional 20% needs to be contributed.wp-config.phpLet's go!
terms of settlement
I was previously using the Redis plugin.object-cache.phpThe document contained Redis-related code, but it didn't work this time. After searching for a long time, I finally found a solution!
Open this.wp-config.phpdocument!
Add the following code:
define('WP_REDIS_PASSWORD', '你的密码'); # Redis密码
Redis Other Configuration Parameters
define('WP_REDIS_CLIENT', 'pecl'); # 指定用于与Redis通信的客户端, pecl 即 The PHP Extension Community Library
define('WP_REDIS_SCHEME', 'tcp'); # 指定用于与Redis实例进行通信的协议
define('WP_REDIS_HOST', '127.0.0.1'); # Redis服务器的IP或主机名
define('WP_REDIS_PORT', '6379'); # Redis端口
define('WP_REDIS_DATABASE', '0'); # 接受用于使用该SELECT命令自动选择逻辑数据库的数值
define('WP_REDIS_PASSWORD',''); # Redis密码
define('WP_CACHE_KEY_SALT', 'wp_'); # 设置所有缓存键的前缀(Wordpress多站点模式下使用)
define('WP_REDIS_MAXTTL', '86400');