blink/redis
Composer 安装命令:
composer require blink/redis
包简介
A redis component for the Blink framework
README 文档
README
Features
- A Redis Client compatible with Predis API
- Implemented PSR-16 SampleCache
- A Session Storage class to store sessions into redis
Installation
You can install the latest version of blink-redis by using Composer:
composer require blink/redis:dev-master
Documentation
Configuring a redis service
You can easily configure a redis service in the services definition file which located to src/config/services.php by default.
The following is a sample example:
'redis' => [ 'class' => blink\redis\Client::class, 'servers' => ['tcp://127.0.0.1:6379'], ]
Once the redis service configured, we can access redis server through app()->redis in our application. As
the Redis component is based on Predis, you can refer their documentation on
how to issue command to redis servers.
Using redis as a cache service
The component provides a PSR-16 SampleCache implementation which using redis as a cache storage. We can define
a cache service in services.php likes the folowing:
'cache' => [ 'class' => blink\redis\cache\SampleCache::class, 'redis' => 'redis', // The redis service to store cached data 'prefix' => '', // The prefix of cached key ]
Once the cache service configured, we can access the cache service through app()->cache in our application.
Using redis as session storage
The component also provides a Session Storgae class which allows Blink to store application sessions into redis. we can configure the session storage in the following way:
'session' => [ 'class' => blink\session\Manager::class, 'expires' => 3600 * 24 * 15, 'storage' => [ 'class' => blink\redis\session\Storage::class, 'redis' => 'redis', // the redis service to store sessions ] ],
blink/redis 适用场景与选型建议
blink/redis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36.13k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「redis」 「cache」 「Blink」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 blink/redis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 blink/redis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 blink/redis 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Cache that expires in the blink of an eye
The Blink HTMLTokenizer ported to PHP.
The Blink HTMLTokenizer ported to PHP. Fork by derUli.
repository php library
Sentry integration for Blink Framework
Microservice RPC through message queues.
统计信息
- 总下载量: 36.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 15
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-28