WordPress

wordpress redis 缓存设置

介绍如何配置 WordPress 的 Redis 对象缓存,包括基础配置和 Redis Cache Pro 的高级配置方法

wordpress redis 缓存设置

设置流程

开启redis对象缓存

安装 redis cache 插件

配置redis

define('WP_REDIS_DATABASE', 1);  // 使用 Redis 数据库1
define('WP_CACHE_KEY_SALT', 'zidingyi_');

在 wp-config.php 中添加以上代码,可以在多个网站开启 redis 时,避免缓存冲突。

redis cache pro配置

参考官方文档https://objectcache.pro/docs

define('WP_REDIS_CONFIG', [
    'host' => '127.0.0.1',
    'port' => 6379,
    'database' => 1, // change for each site
    'maxttl' => 86400 * 7,
    'timeout' => 1.0,
    'read_timeout' => 1.0,
    'split_alloptions' => true,
    'debug' => false,
]);

define('WP_REDIS_DISABLED', false);

wordpress redis 缓存设置

www.jsom.top/post/wordpress-redis-缓存设置

👋

13 篇文章

38 个话题

2,157 次访问

Comments