PHPDaemon\Network\Client::getConnectionByKey PHP Méthode

getConnectionByKey() public méthode

Returns available connection from the pool by key
public getConnectionByKey ( string $key, callable $cb = null ) : boolean
$key string Key
$cb callable Callback
Résultat boolean Success
    public function getConnectionByKey($key, $cb = null)
    {
        if (is_object($key)) {
            return $key->onConnected($cb);
        }
        srand(crc32($key));
        $addr = array_rand($this->servers);
        srand();
        return $this->getConnection($addr, $cb);
    }