e96 / yii2-redis
为 Yii 框架提供的 Redis 缓存、会话和 ActiveRecord
2.1.8
2018-01-25 13:40 UTC
Requires
- yiisoft/yii2: >=2.0.4
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1.1
- 2.1.1
- 2.1.0
- dev-master / 2.0.x-dev
- 2.0.5
- 2.0.4.4
- 2.0.4.3
- 2.0.4.2
- 2.0.4.1
- 2.0.4
- 2.0.3.6
- 2.0.3.5
- 2.0.3.4
- 2.0.3.3
- 2.0.3.2
- 2.0.3.1
- 2.0.3
- 2.0.2
- 2.0.1.5
- 2.0.1.4
- 2.0.1.3
- 2.0.1.2
- 2.0.1.1
- 2.0.1
- 2.0.0
- 2.0.0-rc
- 2.0.0-beta
- 2.0.0-alpha
- dev-refacoring
- dev-phpredis
- dev-primary-key-hash
- dev-is-attribute-changed
- dev-refactoring
This package is not auto-updated.
Last update: 2024-09-14 17:37:33 UTC
README
- 在散列中存储 pk
- 获取长字符串失败
- 最小和最大数字比较
- 在跟踪中添加更多详细信息
- 在调试器 DB 面板中显示配置文件
- 将 inCondition 转换为单个键
- 正确检测修改后的值
- 正确检测修改后的值 +
- 正确检测修改后的值 +
- 修复 populate null 属性
- 修复 buildKey 中的整数值
- 将 Connection::parseResponse 公开
- 将连接从套接字更改为 phpredis
迁移指南
由于 pk 存储算法与官方扩展不兼容,本版本不兼容官方扩展。要迁移到我们的版本,您应该迁移您的 pks。示例代码
function fill($keys) { foreach ($keys as $key) { yield $key; yield 0; } } $keys = $redis->executeCommand('LRANGE', ['model', 0, -1]); $keys = iterator_to_array(fill($keys)); $keys = array_unshift($keys, 'model') $redis->executeCommand('DEL', 'model') $redis->executeCommand('HMSET', $keys)
为 Yii 2 提供的 Redis 缓存、会话和 ActiveRecord
此扩展为 redis 键值存储提供了对 Yii 框架 2.0 的支持。它包括一个 Cache
和 Session
存储处理程序,并实现了 ActiveRecord
模式,允许您将活动记录存储在 Redis 中。
有关许可信息,请参阅 LICENSE 文件。
文档在 docs/guide/README.md。
要求
所有组件正常运行至少需要 redis 版本 2.6.12。
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist e96/yii2-redis
或添加
"e96/yii2-redis": "~2.0.0"
到您的 composer.json 的 require 部分。
配置
要使用此扩展,您必须配置应用程序配置中的 Connection 类
return [ //.... 'components' => [ 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => 'localhost', 'port' => 6379, 'database' => 0, ], ] ];