Coder Social home page Coder Social logo

maykonn / codeigniter-predis Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 5.0 460 KB

Redis for CodeIgniter Framework with Multiple Redis Servers in an easy way!

Home Page: https://github.com/Maykonn/codeigniter-predis

License: MIT License

PHP 99.66% Shell 0.01% ApacheConf 0.01% HTML 0.31%

codeigniter-predis's People

Contributors

maykonn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

codeigniter-predis's Issues

List of servers on configuration file

  • Separate servers list to a specific index on configuration array. Example:
$config['redis'] = [
    'servers' => [
        'server_users' => [
            'scheme' => 'tcp',
            'host' => 'localhost',
            'port' => 6379,
            'password' => null,
            'database' => 0,
        ],
        'server_orders' => [
            'scheme' => 'tcp',
            'host' => '127.0.0.1',
            'port' => 6379,
            'password' => null,
            'database' => 5,
        ],
    ],
];
  • Add a new index referring to the default server(when not inform on connection some server, this lib will try to connect to the default server):
$config['redis'] = [
    'default_server' => 'server_users'
];

Auto connect configured servers

Problem:

To perform redis commands in a "disconnected"(not instantiated yet) server is necessary call the connect method before call the command:

// don't works without call the connect method before:
$redis->getServersCollection()->getServer('some_server')->some_redis_command();

// works:
$this->redis->connect('some_server');
$redis->getServersCollection()->getServer('some_server')->some_redis_command();

Solution:

Servers configured in config file needs to be auto instantiated when called if not instantiated yet. Maybe a status(CONNECTED, DISCONNECTED) property in RedisServer.php class can help with this.

// this code will auto instantiate the server if not instantiated yet, by calling automatically the connect method:
$redis->getServersCollection()->getServer('some_server')->some_redis_command();

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.