humanmade/wp-redis-predis-client
Composer 安装命令:
composer require humanmade/wp-redis-predis-client
包简介
README 文档
README
|
WP Redis - Predis Client An alternative Redis client for use with WP Redis. Enables TLS connections. |
|
| A Human Made project. Maintained by @nathanielks. |
|
WP Redis - Predis Client
This is a package that enables the use of Predis as a Redis Client as opposed to PHPRedis for WP Redis. Predis has the distinct advantage of connecting to Redis via TLS, encrypting traffic in-transit. Requires WP Redis >= 0.7.0.
Getting Started
Requiring Files
Composer
When using Composer, functions.php file will automatically be loaded whenever you include Composer's autoloader in your project.
Manually Requiring
The only file needing require_onceing for WP Predis to work correctly is functions.php (which is automatically included via vendor/autoload.php, which is generated by Composer). Download this repo somewhere in your project, run composer install, and include vendor/autoload.php somewhere early (such as wp-config.php):
require_once '/path/to/wp-redis-predis-client/vendor/autoload.php';
Object Cache stub
Now that files have been included, it's recommended you use the included object-cache.php file instead of the one included with WP Redis. It will add the required filters for WP Predis to work and then include WP Redis' object-cache.php file. Once object-cache.php is in wp-content (or whatever content directory you are using), you're good to go!
Configuring Predis
WP Redis - Predis Client adheres to WP Redis' configuration details. Predis also takes an additional argument, ssl, for configuring TLS connections. See PHP's SSL Context options for more details.
global $redis_server; $redis_server = array( 'host' => '127.0.0.1', 'port' => 6379, 'ssl' => array( 'local_cert' => '/path/to/certificate_and_key.pem', 'verify_peer' => true, ), );
Requirements
- PHP 8.2 or higher
- Predis 3.2.0 or higher
- WordPress (when used in production)
Testing
This package includes comprehensive tests for both standalone and WordPress integration scenarios.
Quick Test
Run the test suite locally (requires Redis):
# Install dependencies composer install # Start Redis docker run -d --name redis-test -p 6379:6379 redis:latest # Run tests vendor/bin/phpunit # Stop Redis docker stop redis-test && docker rm redis-test
Docker Testing (Multiple PHP Versions)
Test across multiple PHP versions using Docker Compose:
# Start services docker compose up -d redis # Run tests with PHP 8.2 docker compose run --rm test-php82 vendor/bin/phpunit # Run tests with PHP 8.3 docker compose run --rm test-php83 vendor/bin/phpunit # Run tests with PHP 8.4 docker compose run --rm test-php84 vendor/bin/phpunit # Stop services docker compose down
For detailed testing documentation, see TESTING.md.
humanmade/wp-redis-predis-client 适用场景与选型建议
humanmade/wp-redis-predis-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 237.76k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2019 年 03 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 humanmade/wp-redis-predis-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 humanmade/wp-redis-predis-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 237.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 30
- 点击次数: 12
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-03-05