Yar 是一个支持多种打包协议的, 并行的RPC框架.

它基于HTTP协议, 在libcurl基础上开发而成

简单的Server:

class API {
    /**
* the doc info will be geneRATed automatically into servICE info page.
* @params
* @return
*/
    public Function api($parameter, $option = "foo") {
    }

    protected function clIEnt_can_not_see() {
    }
}

$service = new Yar_Server(new API());
$service->handle();
?>

 简单调用:

$client = new Yar_Client("http://host/api/");
$result = $client->api("parameter);
?>
 并行调用:
function callback($retval, $callinfo) {
     var_dump($retval);
}

Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::loop(); //send
?>

更多信息参看: Yar at Github

Yar 2.0.2 发布,并行 RPC 框架
Yar 已于 2017.3.15 发布了 2.0.2 版本。该版本的更新主要是: Fixed issue #98 (Memeory exhuasted while using with Yaf) 下载地址 Source code (zip) Source cod

发布于 2017-03-22 23:30:06 | 119 次阅读

php7安装yar扩展的方法详解
本篇内容主要为大家提供的是php7安装yar扩展的方法详解。感兴趣的同学可以参考学习下,具体内容如下:

发布于 2017-08-17 07:27:58 | 75 次阅读

php7 安装yar 生成docker镜像
本篇内容主要为大家提供的是php7 安装yar 生成docker镜像。感兴趣的同学可以参考学习下,具体内容如下:

发布于 2017-08-07 07:48:40 | 126 次阅读


Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务