2 Star 1 Fork 0

Wang Ningkai / yii2-phpredis

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Yii 2 Redis extension using phpredis


The original yiisoft/yii2-redis extension uses socket to communicate. It has performance issues in high concurrency: long response time, and Failed to read from socket error. Instead of using the socket, this extension uses the phpredis to connect to redis server, and all classes and methods has save input and output as the original extension.

Yii 原始的 yiisoft/yii2-redis 扩展使用 socket 进行通信,在高并发下有性能问题,响应时间较长,并且会出现 Failed to read from socket 错误。

本扩展在原有 yii2-redis 的基础上,将连接方式替换为使用 php 原生扩展 phpredis/phpredis,性能大幅提高的同时,保持与原有扩展相同的调用方法方式,支持 Cache/Session/ActiveRecord,仅需替换对应类即可。

安装

php composer.phar require --prefer-dist bootell/yii2-phpredis:"*"

配置

return [
    //....
    'components' => [
        'redis' => [
            'class' => 'bootell\redis\Connection',
            'hostname' => 'localhost',
            'port' => 6379,
            'database' => 0,
        ],
    ]
];

说明

  • phpredis 不支持配置超时重试次数 retries,但可配置重试间隔 retry_interval

Comments ( 0 )

Sign in for post a comment

About

Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
1
https://gitee.com/wangningkai/yii2-phpredis.git
git@gitee.com:wangningkai/yii2-phpredis.git
wangningkai
yii2-phpredis
yii2-phpredis
master

Search