MongoDB\Driver\Server::getLatency

(mongodb >=1.0.0)

MongoDB\Driver\Server::getLatencyReturns the latency of this server

说明

final public MongoDB\Driver\Server::getLatency ( void ) : string

Returns the latency of this server (i.e. the client's measured » round trip time of an ismaster command).

参数

此函数没有参数。

返回值

Returns the latency of this server.

错误/异常

范例

Example #1 MongoDB\Driver\Server::getLatency() example

<?php

$manager 
= new MongoDB\Driver\Manager("mongodb://localhost:27017/");

$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
$server $manager->selectServer($rp);

var_dump($server->getLatency());

?>

以上例程的输出类似于:

int(592)

参见

相关文章
php mongodb driver the mongodb driver server classphp mongodb driver cursor returns the server associated with this cursorphp mongodb driver monitoring commandfailedevent returns the command s duration in microsecondsphp mongodb driver monitoring commandfailedevent returns the exception associated with the failed commandphp mongodb driver monitoring commandfailedevent returns the server on which the command was executedphp mongodb driver monitoring commandstartedevent returns the server on which the command was executedphp mongodb driver monitoring commandsucceededevent returns the command s duration in microsecondsphp mongodb driver monitoring commandsucceededevent returns the command s operation idphp mongodb driver monitoring commandsucceededevent returns the server on which the command was executedphp mongodb driver server create a new server not used php mongodb driver server execute one or more write operations on this serverphp mongodb driver server returns the hostname of this serverphp mongodb driver server returns an array of information about this serverphp mongodb driver server returns the latency of this serverphp mongodb driver server returns the port on which this server is listeningphp mongodb driver server returns an array of tags describing this server in a replica setphp mongodb driver server returns an integer denoting the type of this serverphp mongodb driver server checks if this server is a primary member of a replica setphp mongodb driver writeresult returns the number of documents deletedphp mongodb driver writeresult returns the server associated with this write result
关注编程学问公众号