etitov-cm / yii2-redis
为 Yii 框架提供的 Redis 3.x 集群缓存、会话和 ActiveRecord
2.0.15
2020-08-21 17:11 UTC
Requires
- yiisoft/yii2: >=2.0.4
- yiisoft/yii2-redis: ~2.0.0
README
此扩展为 redis 提供了 Yii 框架 2.0 的键值存储支持。它包括一个 Cache
和 Session
存储处理程序,并实现了允许您将活动记录存储在 Redis 中的 ActiveRecord
模式。
有关许可证信息,请查看 LICENSE 文件。
需求
所有组件正常运行至少需要 Redis 版本 3.0。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令
php composer.phar require --prefer-dist etitov-cm/yii2-redis
或者将以下内容添加到您的 composer.json 文件的 require 部分
"etitov-cm/yii2-redis": "*"
to the require section of your composer.json.
配置
要使用此扩展,您需要在您的应用程序配置中配置 Connection 类
return [ //.... 'components' => [ 'redis' => [ 'class' => 'etitov\redis\Connection', 'master' => [ '10.155.20.169:6379', '10.155.20.167:6391', '10.155.20.168:6379', '10.155.20.167:6380', // 'localhost:6379', ], 'database' => 0, ], ] ];