MCRouter::createSimple

Description

public static function createSimple(
  ConstVector<string> $servers,
): MCRouter

Simplified constructor

Parameters

  • \Vector $servers - List of memcache servers to connect to

Return Values

Examples

The following example shows you how use MCRouter::createSimple to create an instance of MCRouter. You only need to pass it a Vector containing one or more locations of Memcached servers; default configurations are used after that (e.g, route = 'PoolRoute|P').

<?hh

namespace Hack\UserDocumentation\API\Examples\MCRouter\MCrouter\CSimple;

function simple_mcrouter(): void {
  $servers = Vector { getenv('HHVM_TEST_MCROUTER') };
  $mc = \MCRouter::createSimple($servers);
  var_dump($mc instanceof \MCRouter);
}

simple_mcrouter();
Output
bool(true)