Get the remote server's current version

public function version(): Awaitable<string>;


  • string - - The remote version


The following example allows you to use MCRouter::version to get the version information of the memcached server you are connected to.

function get_simple_mcrouter(): \MCRouter {
  $servers = Vector {\getenv('HHVM_TEST_MCROUTER')};
  $mc = \MCRouter::createSimple($servers);
  return $mc;

async function get_version(\MCRouter $mc): Awaitable<?string> {
  $ret = null;
  try {
    $ret = await $mc->version();
  } catch (\MCRouterException $ex) {
  return $ret;


async function run(): Awaitable<void> {
  $mc = get_simple_mcrouter();
  $ver = await get_version($mc);
string(%d) "%s"
string(5) "1.4.4"