【问题标题】:issue with compiling predis with hhvm as a php only extension -- RedisCluster::__construct() must be an instance of FactoryInterface, Factory given使用 hhvm 编译 predis 作为 php 唯一扩展的问题 - RedisCluster::__construct() 必须是 FactoryInterface 的实例,Factory 给定
【发布时间】:2025-11-21 13:45:02
【问题描述】:

在构建 HHVM 时,我正在使用 hhvm 扩展 api 尝试将 predis 构建为仅 php 的扩展。 目的是希望从中获得更好的性能。 在连接并重新格式化 predis 库以使其成功编译后,我能够使 Predis\Client 类正常工作。

用于集群配置时完全失败。


可捕获的致命错误:参数 1 传递给 Predis\Connection\Aggregate\RedisCluster::__construct() 必须是 Predis\Connection\Aggregate\FactoryInterface 的实例, Predis\Connection\Factory 给定


我不知道我做错了什么。

【问题讨论】:

  • 您能否在问题标题中添加错误的 sn-p
  • 完成@raphael,希望搜索起来更容易

标签: php php-extension hhvm predis


【解决方案1】:

找到了我的问题的解决方案。在github与predis的所有者协商后

问题出在 Predis 附带的 create-single-file 脚本中。它还有其他问题。我建议不要使用它,除非您准备好在需要的时间内解决问题。

这个特殊问题是类 RedisCluster 实现 ClusterInterface 的构造函数中的类类型错​​误

改正后就可以正常使用了。

希望这对有类似问题的人有所帮助

【讨论】: