The Yar_Concurrent_Client class

Introduction

A static helper that batches remote RPC calls. Calls registered with Yar_Concurrent_Client::call are not sent immediately; they are all dispatched together, in parallel, by Yar_Concurrent_Client::loop.

The class is meant for applications that need the results of several remote calls. Only independent calls — ones that do not need each other's results — can be batched this way; when one call depends on the result of another, the two have to run sequentially. Through Yar_Client the calls are sent one after another, each paying its full round-trip time; with the concurrent client they are sent at the same time, so the overall waiting time drops to the duration of the single slowest call.

Note: Only HTTP(S) services are supported for concurrent calls. They are sent concurrently through curl's multi-handle interface, which the TCP/Unix socket transport does not implement.

Class synopsis

Yar_Concurrent_Client
/* Methods */
public static intfalsenull call(
    string $uri,
    string $method,
    arraynull $parameters = null,
    callablenull $callback = null,
    callablenull $error_callback = null,
    arraynull $options = null
)
public static boolnull loop(callablenull $callback = null, callablenull $error_callback = null, arraynull $options = null)
public static bool reset()
Table of Contents