Giter VIP home page Giter VIP logo

yii2-phpredis's Introduction

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\Yii2\redis\Connection::class,
            'hostname' => 'localhost',
            'port' => 6379,
            'database' => 0,
        ],
    ]
];

说明

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

yii2-phpredis's People

Contributors

bootell avatar ondrejvrabel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yii2-phpredis's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.