Redis Object Cache Pro – 企业级Redis对象缓存wordpress插件v1.24.2

简介

Redis Cache Pro是一款企业级的Redis对象缓存优化WordPress插件,Object Cache Pro已针对WooCommerce进行了广泛的测试和优化,与WordPress本身紧密集成,并且仪表板小部件使交互变得容易。

图片[1]-Redis Object Cache Pro – 企业级Redis对象缓存wordpress插件v1.24.2-淇云博客-专注于IT技术分享

官方网站

官网:https://objectcache.pro

官方说明文档:https://objectcache.pro/docs

官方更新日志:https://objectcache.pro/docs/changelog

插件功能

  • 为原始性能重写
  • 符合 WordPress 对象缓存 API
  • 易于调试和记录
  • 缓存预取和分析
  • 完全单元测试(100% 代码覆盖率)
  • 使用 TLS 进行安全连接
  • 通过 WordPress 和 WP CLI 进行健康检查
  • 针对 WooCommerce、Jetpack 和 Yoast SEO 进行了优化

Redis Cache Pro与其他缓存插件对比

图片[2]-Redis Object Cache Pro – 企业级Redis对象缓存wordpress插件v1.24.2-淇云博客-专注于IT技术分享

使用教程

在站点根目录下的文件wp-config.php里加入如下代码

define('WP_REDIS_CONFIG', [
'token' => 'e279430effe043b8c17d3f3c751c4c0846bc70c97f0eaaea766b4079001c',
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
'maxttl' => 3600 * 24 * 7,
'timeout' => 1.0,
'read_timeout' => 1.0,
'prefetch' => true,
'split_alloptions' => true,
'strict' => true,
'debug' => false,
]);

define('WP_REDIS_DISABLED', getenv('WP_REDIS_DISABLED') ?: false);

成功启动后,WordPress的缓存效果显著,速度非常快,大家可以自己体验!

图片[3]-Redis Object Cache Pro – 企业级Redis对象缓存wordpress插件v1.24.2-淇云博客-专注于IT技术分享

如果启用后,后台报错,请按照下方进行修复

修改文件/wp-content/plugins/object-cache-pro/src/Clients/Client.php

修改87行到99行

原文:
/**
* Forwards all calls to registered callback.
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call($method, $arguments)
{
return $this->{$this->callback}(function () use ($method, $arguments) {
return $this->client->{$method}(...$arguments);
}, \strtolower($method));
}

替换为:
/**
* Forwards all calls to registered callback.
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call($method, $arguments)
{
return $this->{$this->callback}(function () use ($method, $arguments) {
// 临时修复Redis::info参数过多
if (strtolower($method) === 'info' && count($arguments) > 1) {
$arguments = array_slice($arguments, 0, 1);
}

return $this->client->{$method}(...$arguments);
}, \strtolower($method));
}

下载地址

感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
喜欢就支持一下吧
点赞19赞赏 分享
评论 共136条
头像
欢迎提交您的评论,共创文明良好交流环境,请勿提交违规言论!
提交
头像

昵称

取消
昵称表情代码图片快捷回复
    • 头像yisailly0
    • 头像kamisama0
    • 头像良弓0