Skip to content

wueason/loadbalance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoadBalance Build Status

Installation

Simply add a dependency on wueason/loadbalance to your project's composer.json file if you use Composer to manage the dependencies of your project.

Here is a minimal example of a composer.json file that just defines a dependency on LoadBalance:

{
    "require": {
        "wueason/loadbalance": "^1.0"
    }
}

Usage Examples

Creating a LoadBalance object and pick a random instance

use Wueason\Loadbalance\RandomEngine;
use Wueason\Loadbalance\BaseInstance;

// Create Loadbalance object with BaseInstance
$pool = array_map(function($a){
            return new BaseInstance($a);
        }, ['A','B','C']);
$lb = new RandomEngine($pool);

// Get the random instance
print $lb->pick();

About

Load balance implements in PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages