Segment::flush PHP Méthode

flush() public static méthode

Flush the client
public static flush ( )
    public static function flush()
    {
        self::checkClient();
        return self::$client->flush();
    }

Usage Example

Exemple #1
0
    }
    $payload = json_decode($line, true);
    $dt = new DateTime($payload["timestamp"]);
    $ts = floatval($dt->getTimestamp() . "." . $dt->format("u"));
    $payload["timestamp"] = $ts;
    $type = $payload["type"];
    $ret = call_user_func_array(array("Segment", $type), array($payload));
    if ($ret) {
        $successful++;
    }
    $total++;
    if ($total % 100 === 0) {
        Segment::flush();
    }
}
Segment::flush();
unlink($file);
/**
 * Sent
 */
print "sent {$successful} from {$total} requests successfully";
exit(0);
/**
 * Parse arguments
 */
function parse($argv)
{
    $ret = array();
    for ($i = 0; $i < count($argv); ++$i) {
        $arg = $argv[$i];
        if ('--' != substr($arg, 0, 2)) {