Redis Object Cache – 对象缓存

描述

由Redis提供支持的持久对象缓存后端。 支持 PredisPhpRedis(PECL)Relay、replication、sentinels、clustering 和WP-CLI

要调整连接参数、前缀缓存键或配置复制/群集,请参阅配置选项

Object Cache Pro

一个商业级的Redis对象缓存后端。 真正可靠、高度优化、完全可定制,并在您最需要的时候配备专门的工程师。

  • 针对原始性能重写
  • 100% WordPress API兼容
  • 加快序列化和压缩
  • 易于调试的&日志记录
  • 缓存预取和分析
  • 完全单元测试(100%代码覆盖率)
  • 使用TLS实现安全连接
  • 通过WordPress WP CLI进行健康检查&
  • 针对WooCommerce,Jetpack&Yoast SEO优化

了解有关Object Cache Pro的详细信息

1 Redis 是 Redis Ltd 的注册商标。其中的任何权利均归 Redis Ltd 保留。Redis Object Cache 的任何使用仅供参考,并不表明 Redis 和 Redis Object Cache 之间有任何赞助、认可或从属关系。

故障排除

常见问题解答和常见错误的故障排除可在FAQ中找到。 阅读这些总是比在支持论坛中等待响应要快。

配置

该插件提供了大量的配置选项连接示例。 高级用户可以咨询扩展和复制

WP CLI命令

Redis对象缓存有各种WP CLI命令,安装插件后运行wp help redis获取更多信息

屏幕截图

  • 插件设置,连接到单个Redis服务器。

  • 插件设置,显示最近的响应时间指标。
  • 插件设置,显示诊断信息。
  • 仪表板小部件,显示最近的响应时间指标。

安装

有关详细的安装说明,请阅读详细的安装说明

评价

2024 年 4 月 16 日 2 回复
tested on lighthouse with plugin enabled and disabled, giving almost same result
2024 年 3 月 1 日 2 回复
I love how minimal this plugin is. It keeps things nice and light and allows for quick configuration via PHP constants. However I do not recommend using this plugin if you are not familiar with your server configuration or at least editing PHP files.
2024 年 3 月 1 日 2 回复
I purchased the pro version only to realise that it has far more features than I needed. I cancelled according to their 14 day money back guarantee, took a few message to get a response. They requested that I submit a form which I did and never heard form them again.
2024 年 1 月 20 日
I tried everything to make my sites faster (wordpress + woocommerce) which consume a lot of resources. After installing Redis on my VPN and this plugin, my sites started to work smoother and consuming way less resources. I was using memcached plugins, but nothing like this, it just works F great! A word of caution (because it happened to me). If you work with a VPS like me, you MUST separate the cache databases either by unique prefix, database number or both, otherwise the cache will collide and your sites will get mixed. Read the documentation. I easily rate this the best plugin for object cache (and I have tried literally almost all cache plugins out there) and making your website fast even in low spec servers.
阅读所有156条评价

贡献者及开发者

“Redis Object Cache – 对象缓存” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

「Redis Object Cache – 对象缓存」插件已被翻译至 10 种本地化语言。 感谢所有译者为本插件所做的贡献。

将“Redis Object Cache – 对象缓存”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

2.5.1

  • 为诊断添加了超时
  • 支持罕见的不带 sockets 扩展的 PHP 安装
  • 修复了 show_error_and_die() 中罕见的致命错误
  • 修复了 sanitize_key_part()= 2.5.0 = 中的弃用通知警告

  • 需要 WordPress 4.6 或更高版本

  • 仅在需要时加载文本域
  • 添加了 WP_REDIS_DISABLE_DROPIN_CHECK 常量
  • 遵守 file_mod_allowed 过滤器和 DISALLOW_FILE_MODS 常量
  • 重命名 .redis-write-test.tmp 测试文件为 object-cache.tmp
  • wp_die() 之前调用 redis_object_cache_error 动作
  • 允许在其他地方定义 WP_REDIS_PLUGIN_PATH
  • 添加了实验性的刷新时超时时间(默认为 5 秒)
  • 删除不必要的默认忽略组

2.4.4

  • 改进对意外交易结果的处理

2.4.3

  • 修正了 PHP <=7.2 语法错误
  • 修正了加载错误页面的翻译

2.4.2

  • 使管理栏脚本更加强大
  • 改进了 redis-error.php 中的恢复说明
  • 改进 CloudLinux 检测
  • 本地化改进
  • 防止 W3 Total Cache 和 LiteSpeed Cache 覆盖下拉菜单
  • 修复了使用 Predis 和数组语法时对 ACL 用户名的支持

2.4.1

  • 修复 PHP <=7.2 语法错误

2.4.0

  • 切换对象缓存时清空缓存
  • 当 Redis 无法访问时显示自定义错误信息
  • 当 Redis 无法访问时,不允许启用对象缓存
  • 已弃用有风险的 WP_REDIS_SERIALIZER 配置常量,请使用 WP_REDIS_IGBINARY 代替。
  • 使用 Predis 时支持 WP_REDIS_USERNAME
  • 在管理栏节点中显示缓存命中率小数点
  • 在显示 WP_REDIS_SERVERS 时隐藏秘密
  • 改进 CloudLinux 的加速 WP 兼容性
  • 管理栏缓存清除现在使用 AJAX

2.3.0

  • 仅向管理员显示仪表板部件
  • 已添加管理栏节点(使用 WP_REDIS_DISABLE_ADMINBAR 关闭该节点)
  • 已添加 WP_REDIS_SSL_CONTEXT 配置常量
  • 连接错误时抛出错误
  • 使用 Predis 时已添加对用户名的支持
  • 已添加对从 WP_REDIS_PLUGIN_PATH 加载 Predis 的支持
  • 使 Predis unix 套接字连接更严格
  • 修正了罕见的群组刷新错误
  • 修复了使用 Predis 时的群集 ping 问题
  • 已将 Predis 更新至 v2.1.2
  • 改进文件

2.2.4

  • 延迟注册wp redis CLI命令
  • 不要与Object Cache Pro竞争wp redis命令
  • 防止Perflab覆盖对象缓存插入
  • 将Predis更新为v2.1.1
  • 避免事务失败时出现类型错误
  • 检查不兼容的内容类型标头

2.2.3

  • 添加了wp_cache_flush_group()支持
  • 将Credis更新为v1.14.0
  • wp_cache_flush()中删除$delay参数
  • 阅读连接错误时,防止诊断中出现罕见错误

2.2.2

  • 使用QM_Data_Cache代替QM_Data
  • 修复了WP_Error使用语句非复合名称警告

2.2.1

  • 添加了WordPress 6.1中的wp_cache_supports()函数
  • 将Predis更新为v2.0.3
  • 避免WP_Object_Cache::get()中的早期微时间()调用
  • 支持查询监视器的新QM_Data类
  • 当管道返回意外结果时抛出异常

2.2.0

  • 添加了redis_cache_add_non_persistent_groups过滤器
  • 修复了wp_add_dashboard_widget参数
  • 修复了Predis v2.0的WP_REDIS_SERVERS复制问题
  • 修复了WP_REDIS_CLUSTER字符串支持
  • 修复了MGET在get_multiple()调用中失败的问题
  • 修复了管道故障时的几个警告

2.1.6

  • 修复SVN差异

2.1.5

  • 修复了is_predis()调用

2.1.4

  • 添加了is_predis()帮助器

2.1.3

  • 修复了wp_cache_add_multiple()和wp_cache_set_multiple()中的错误

2.1.2

  • 修复并改进了wp_cache_*_multiple()逻辑
  • 调用wp_cache_set_multiple()中的redis_object_cache_set操作
  • 调用wp_cache_delete_multiple()中的redis_object_cache_delete操作
  • 检查是否忽略原始组名,而不是整理的名称
  • 删除跟踪

2.1.1

  • 将PHP要求提升至7.2
  • 将WP_REDIS_DIR重命名为WP_REDIS_PLUGIN_DIR
  • 修复了诊断中罕见的致命错误
  • 允许安装Predis v1.1 Composer
  • 支持使用WP_REDIS_CLUSTER字符串

2.1.0

  • 将PHP要求提升至7.0
  • 弃用的Credis和HHVM客户端
  • 将Predis更新为v2.0.0
  • 将Credis更新为v1.13.1
  • 改进诊断中的群集可读性
  • 改进的群集连接
  • 修复了连接后ping群集的问题
  • 修复了connect_using_credis()中的几个错误

2.0.26

  • 修正了使用Predis时wp_cache_delete_multiple()中的一个错误
  • 修复了缓存添加挂起时wp_cache_add_multiple()中的错误

2.0.25

  • 删除了损坏的wp_cache_add_multiple()函数

2.0.24

  • 改进指标标签/工具提示格式
  • 修复指标图表不呈现的问题
  • 将Predis更新为v1.1.10
  • 将Credis更新为v1.13.0
  • 支持 编写器/安装程序v1和v2
  • 找到外部插件时链接到设置页面
  • 添加了wp_cache_flush_runtime()函数
  • 添加了wp_cache_add_multiple()函数
  • 添加了wp_cache_delete_multiple()函数

2.0.23

  • 添加了对中继的支持
  • 次要UX修复和改进
  • 修复了PHP 8.1弃用通知
  • 将ApexChart更新为v3.31.0

2.0.22

  • PHP 8.1兼容性修复
  • 升级至Predis v1.1.9
  • 添加了小部件的设置链接
  • 全面检查诊断窗格
  • 将ApexChart更新为v3.30.0
  • 激活后重定向至插件设置
  • 修正了 diagnostics.php 文件的错误路径。
  • 修复了设置选项卡中的图表溢出
  • 修复Predis群集ping
  • 避免在内容文件夹不可写时发出警告

2.0.21

  • 添加了指标诊断
  • 已添加 WP_Object_Cache::decr() 别名
  • 移动了 diagnostics.php 文件

2.0.20

  • 修复wp.org版本

2.0.19

  • 使指标标识符唯一
  • 为托管在Cloudways上的网站设置唯一前缀
  • WP_CLItrue 时,不打印 HTML 调试注释。

2.0.18

  • 已添加 redis_object_cache_trace 操作和 WP_REDIS_TRACE 常量。
  • 将ApexChart更新为v3.26.0
  • 修复了 WP_REDIS_DISABLE_METRICS 的问题。

2.0.17

  • 代码清理
  • 修复了缺少的指标
  • 固定文件系统测试

2.0.16

  • 将Credis更新为v1.11.4
  • 修复了插播通知样式
  • 将指标移至专用类
  • 已添加 redis_cache_validate_dropin 过滤器
  • 使用 WP_DEBUG_DISPLAY 常量(而不是 WP_DEBUG 常量)显示调试信息
  • 修正 wp_cache_get_multiple() 中的罕见错误。
  • 删除了 intval() 的用法

2.0.15

  • 由于多站点环境中的问题,还原了 build_key() 的更改

2.0.14

  • 使Object Cache Pro卡可翻译
  • 已在诊断程序中添加 WP_REDIS_SERIALIZER
  • 提高了 build_key() 的速度
  • 支持通过环境变量设置WP_REDIS_PREFIXWP_REDIS_SELECTIVE_FLUSH
  • 已添加 WP_REDIS_METRICS_MAX_TIME 以调整存储的度量时限
  • 延迟加载文本域和计划表,直到 init 钩子
  • 将捆绑的Predis库升级至v1.1.6
  • 防止 connect_using_credis() 中的变量引用问题

2.0.13

  • 将捆绑的Predis库更新为v1.1.4
  • redis-cache 设为全局组,以改进多站点上的指标
  • 切换到短数组语法
  • 已为所有钩子添加 @since 标记
  • 在 drop-in 中使用 parse_url() 代替 wp_parse_url()
  • 修正了 wp redis status 中的插件实例变量名。

2.0.12

  • 固定字节度量计算
  • 修正了非标准Predis配置的问题
  • 改进WordPress编码标准

2.0.11

  • 当使用 Predis 时,修正了 wp_cache_get_multiple() 中的一个问题。
  • 防止诊断中出现未定义的索引通知

2.0.10

  • 修正了在 wp_cache_get_multiple() 中对数值的非序列化。

2.0.9

  • 使用颜色突出显示当前指标类型
  • 禁用指标时显示“指标”选项卡
  • 重构连接和Redis状态逻辑
  • 将Predis更新为v1.1.2
  • 删除Predis弃用通知
  • 修复了在 wp_cache_get_multiple() 中获取派生键的问题。

2.0.8

  • 修复了由于www.example.com SVN问题而在2.0.6和2.0.7中无法使用的选项卡WP.org

2.0.7

  • 修复了 wp_cache_get_multiple() 的问题。

2.0.6

  • 诊断中添加了实验性文件系统测试
  • 重构了设置选项卡逻辑(也修复了跳转问题)
  • 修复了 wp_cache_get_multiple() 的问题。
  • wp_cache_delete() 返回布尔值
  • 使用 redis-cache 作为 JS 事件命名空间
  • 禁用横幅时隐藏小部件中的Pro行
  • redis_object_cache_get_multi 动作重命名为 redis_object_cache_get_multiple

2.0.5

2.0 版是对插件的重大重写。请阅读 v2.0.0 发布说明。

  • 修复了多站点操作按钮失灵的问题
  • 删除了过时的 PHP 5.4 警告
  • 为 Credis 添加了 read_timeout 支持
  • 使用 Credis 时显示连接参数
  • 已添加 Predis 升级通知的维基链接

2.0.4

  • 当 dropin 过时时,尝试可靠地更新它
  • 在设置屏幕上显示 ACL 用户名
  • 使用 wp redis status 显示完整诊断信息
  • 复制object-cache.php时,始终设置FS_CHMOD_FILE
  • 不要在密码诊断中对子弹进行编码
  • 更新 dropin 时调用 redis_object_cache_update_dropin

2.0.3

  • 禁用度量标准时隐藏 “度量标准 “选项卡
  • 修复了 admin.js 在多站点环境中无法加载的问题。
  • 避免在与度量指标交互时出现致命错误,但 Redis 却消失了
  • 已添加 WP_Object_Cache::__get() 以实现向后兼容性

2.0.2

  • 更新了 POT 文件和译者注释

2.0.1

  • 支持旧版本的查询监控器
  • 使 “Dropin “状态更有帮助
  • 当 Redis 版本不可用时,在设置中隐藏 Redis 版本
  • 使用 composer-custom-directory-installer 软件包时折叠的依赖路径
  • 防止 QM_Collector 与其他插件冲突
  • 防止无法使用缓存时出现度量问题
  • 修复了插件列表中的 “设置 “链接
  • 修正了 WP_REDIS_DISABLED 逻辑

2.0.0

2.0 版是一次重大重写。插件现在需要 PHP 5.6,就像 WordPress 5.2 一样。

GitHub 和 Composer 存储库从 tillkruss/redis-cache 移至 rhubarbgroup/redis-cache

在多站点网络上,升级到 v2.x 后,请务必 “网络激活 “插件。

  • 要求 PHP 5.6
  • 插件现在 “仅限网络 “使用
  • Switch to WPCS for code standards
  • Overhauled the settings screen
  • Added object cache metrics (on dashboard widget and settings)
  • Added support for Query Monitor
  • Added Rhubarb\RedisCache namespace to all files
  • Added support for WP 5.5’s new wp_cache_get_multi() function
  • Added redis_object_cache() function to retrieve plugin instance
  • Added dropin warnings to network dashboard
  • Added support for setting Sentinel database numbers
  • Support Redis 6 ACL username and password authentication
  • Support overwriting existing dropin on setting screen
  • Use singleton pattern to instantiate plugin
  • Use Composer to install and load Predis
  • Update object cache dropin during plugin update
  • Use separate methods to connect with all clients
  • Removed CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE weirdness
  • Added themes as ignored group
  • Changed default connection and read timeout to 1 second
  • Prevent race condition in add_or_replace()
  • Renamed WP_CACHE_KEY_SALT to WP_REDIS_PREFIX for clarity
  • Replaced “slave” terminology with “replica”
  • Only SELECT database when it’s not 0

1.6.1

  • Fixed issue with footer comment showing during AJAX requests

1.6.0

  • Improved group name sanitization (thanks @naxvog)
  • Prevent fatal error when replacing foreign dropin
  • Added HTML footer comment with optional debug information
  • Removed prefix suggestions

The HTML footer comment only prints debug information when WP_DEBUG is enabled. To disable the comment entirely, set the WP_REDIS_DISABLE_COMMENT constant to true.

1.5.9

  • Fixed missing $info variable assignment in constructor
  • Fixed MaxTTL warning condition
  • Switched to using default button styles

1.5.8

  • Added warning message about invalid MaxTTL
  • Added warning about unmaintained Predis library
  • Added suggestion about shorter, human-readable prefixes
  • Added Redis Cache Pro compatibility to settings
  • Fixed flushing the cache when the prefix contains special characters
  • Fixed calling Redis INFO when using clusters
  • Cleaned up the settings a little bit

1.5.7

  • Added support for PhpRedis TLS connections
  • Added support for timeout, read timeout and password when using PhpRedis cluster
  • Fixed issue with INFO command
  • Fixed object cloning when setting cache keys

1.5.6

  • Added object cloning to in-memory cache
  • Fixed PHP notice related to read_timeout parameter

1.5.5

Please flush the object cache after updating the drop to v1.5.5 to avoid dead keys filling up Redis memory.

  • Removed lowercasing keys
  • Remove scheduled metrics event
  • Fixed Redis version call when using replication

1.5.4

  • Removed metrics

1.5.3

  • Fixed: Call to undefined function get_plugin_data()
  • Fixed: Call to undefined method WP_Object_Cache::redis_version()

1.5.2

  • Added Redis version to diagnostics
  • Added WP_REDIS_DISABLE_BANNERS constant to disable promotions
  • Fixed an issue with redis.replicate_commands()

1.5.1

This plugin turned 5 years today (Nov 14th) and its only fitting to release the business edition today as well.
Object Cache Pro is a truly reliable, highly optimized and easy to debug rewrite of this plugin for SMBs.

  • Added execution times to actions
  • Added WP_REDIS_VERSION constant
  • Fixed PhpRedis v3 compatibility
  • Fixed an issue with selective flushing
  • Fixed an issue with mb_* functions not existing
  • Replaced Email Address Encoder card with Redis Cache Pro card
  • Gather version metrics for better decision making

1.5.0

Since Predis isn’t maintained any longer, it’s highly recommended to switch over to PhpRedis (the Redis PECL extension).

  • Improved Redis key name builder
  • Added support for PhpRedis serializers
  • Added redis_object_cache_error action
  • Added timeout, read-timeout and retry configuration
  • Added unflushable groups (defaults to ['userlogins'])
  • Fixed passwords not showing in server list

1.4.3

  • Require PHP 5.4 or newer
  • Use pretty print in diagnostics
  • Throw exception if Redis library is missing
  • Fixed cache not flushing for some users
  • Fixed admin issues when WP_REDIS_DISABLED is false

1.4.2

  • Added graceful Redis failures and WP_REDIS_GRACEFUL constant
  • Improved cluster support
  • Added redis_cache_expiration filter
  • Renamed redis_object_cache_get filter to redis_object_cache_get_value

1.4.1

  • Fixed potential fatal error related to wp_suspend_cache_addition()

1.4.0

  • Added support for igbinary
  • Added support for wp_suspend_cache_addition()

1.3.9

  • Fixed WP_REDIS_SHARDS not showing up in server list
  • Fixed WP_REDIS_SHARDS not working when using PECL extension
  • Removed WP_REDIS_SCHEME and WP_REDIS_PATH leftovers

1.3.8

  • Switched from single file Predis version to full library

1.3.7

  • Revert back to single file Predis version

1.3.6

  • Added support for Redis Sentinel
  • Added support for sharing
  • Switched to PHAR version of Predis
  • Improved diagnostics
  • Added WP_REDIS_SELECTIVE_FLUSH
  • Added $fail_gracefully parameter to WP_Object_Cache::__construct()
  • Always enforce WP_REDIS_MAXTTL
  • Pass $selective and $salt to redis_object_cache_flush action
  • Don’t set WP_CACHE_KEY_SALT constant

1.3.5

  • Added basic diagnostics to admin interface
  • Added WP_REDIS_DISABLED constant to disable cache at runtime
  • Prevent “Invalid plugin header” error
  • Return integer from increment() and decrement() methods
  • Prevent object cache from being instantiated more than once
  • Always separate cache key prefix and group by semicolon
  • Improved performance of build_key()
  • Only apply redis_object_cache_get filter if callbacks have been registered
  • Fixed add_or_replace() to only set cache key if it doesn’t exist
  • Added redis_object_cache_flush action
  • Added redis_object_cache_enable action
  • Added redis_object_cache_disable action
  • Added redis_object_cache_update_dropin action

1.3.4

  • Added WP-CLI support
  • Show host and port unless scheme is unix
  • Updated default global and ignored groups
  • Do a cache flush when activating, deactivating and uninstalling

1.3.3

  • Updated Predis to v1.1.1
  • Added redis_instance() method
  • Added incr() method alias for Batcache compatibility
  • Added WP_REDIS_GLOBAL_GROUPS and WP_REDIS_IGNORED_GROUPS constant
  • Added redis_object_cache_delete action
  • Use WP_PLUGIN_DIR with WP_CONTENT_DIR as fallback
  • Set password when using a cluster or replication
  • Show Redis client in stats()
  • Change visibility of $cache to public
  • Use old array syntax, just in case

1.3.2

  • Make sure $result is not false in WP_Object_Cache::get()

1.3.1

  • Fixed connection issue

1.3

  • New admin interface
  • Added support for wp_cache_get()‘s $force and $found parameter
  • Added support for clustering and replication with Predis

1.2.3

  • UI improvements

1.2.2

  • Added redis_object_cache_set action
  • Added redis_object_cache_get action and filter
  • Prevented duplicated admin status messages
  • Load bundled Predis library only if necessary
  • Load bundled Predis library using WP_CONTENT_DIR constant
  • Updated stats() method output to be uniform with WordPress

1.2.1

  • Added composer.json
  • Added deactivation and uninstall hooks to delete object-cache.php
  • Added local serialization functions for better advanced-cache.php support
  • Updated bundled Predis version to 1.0.3
  • Updated heading structure to be semantic

1.2

  • Added Multisite support
  • Moved admin menu under Settings menu
  • Fixed PHP notice in get_redis_client_name()

1.1.1

  • Call select() and optionally auth() if HHVM extension is used

1.1

  • Added support for HHVM’s Redis extension
  • Added support for PECL Redis extension
  • Added WP_REDIS_CLIENT constant, to set preferred Redis client
  • Added WP_REDIS_MAXTTL constant, to force expiration of cache keys
  • Improved add_or_replace(), get(), set() and delete() methods
  • Improved admin screen styles
  • Removed all internationalization/localization from drop-in

1.0.2

  • Added “Flush Cache” button
  • Added support for UNIX domain sockets
  • Improved cache object retrieval performance significantly
  • Updated bundled Predis library to version 1.0.1

1.0.1

  • Load plugin translations
  • Hide global admin notices from non-admin users
  • Prevent direct file access to redis-cache.php and admin-page.php
  • Colorize “Disable Object Cache” button
  • Call Predis\Client->connect() to avoid potential uncaught Predis\Connection\ConnectionException

1.0

  • Initial release