<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Yar并行的RPC框架

          聯(lián)合創(chuàng)作 · 2023-09-23 13:21

          Yar 是一個支持多種打包協(xié)議的, 并行的RPC框架.

          它基于HTTP協(xié)議, 在libcurl基礎(chǔ)上開發(fā)而成

          簡單的Server:

           
          1. class API {
          2.     /**
          3. * the doc info will be generated automatically into service info page.
          4. * @params
          5. * @return
          6. */
          7.     public function api($parameter, $option = "foo") {
          8.     }
          9.  
          10.     protected function client_can_not_see() {
          11.     }
          12. }
          13.  
          14. $service = new Yar_Server(new API());
          15. $service->handle();
          16. ?>

          簡單調(diào)用:

           
          1. $client = new Yar_Client("http://host/api/");
          2. $result = $client->api("parameter);
          3. ?>

          并行調(diào)用:

           
          1. function callback($retval, $callinfo) {
          2.      var_dump($retval);
          3. }
          4.  
          5. Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
          6. Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
          7. Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
          8. Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
          9. Yar_Concurrent_Client::loop(); //send
          10. ?>

          更多信息參看: Yar at Github

          瀏覽 27
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  亚洲无在线观看 | 91成人影库一级A片 | 99精品人妻 | 亚洲第97页 | 小骚逼黄色大片 |