MCRouter
This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information.
Interface Synopsis
class MCRouter {...}
Public Methods
-
::createSimple(Vector $servers): MCRouter
Simplified constructor -
::getOpName(int $op): string
Translate an mc_op_* numeric code to something human-readable -
::getResultName(int $op): string
Translate an mc_res_* numeric code to something human-readable -
->__construct(darray<string, mixed> $options, string $pid = ''): void
Initialize an MCRouter handle -
->add(string $key, string $value, int $flags = 0, int $expiration = 0): Awaitable<void>
Store a value -
->append(string $key, string $value): Awaitable<void>
Modify a value -
->cas(int $cas, string $key, string $value, int $expiration = 0): Awaitable<void>
Compare and set -
->decr(string $key, int $val): Awaitable<int>
Atomicly decrement a numeric value -
->del(string $key): Awaitable<void>
Delete a key -
->flushAll(int $delay = 0): Awaitable<void>
Flush all key/value pairs -
->get(string $key): Awaitable<string>
Retreive a value -
->gets(string $key): Awaitable<shape('value' => string, 'cas' => int, 'flags' => int), darray>
Retreive a record and its metadata -
->incr(string $key, int $val): Awaitable<int>
Atomicly increment a numeric value -
->prepend(string $key, string $value): Awaitable<void>
Modify a value -
->replace(string $key, string $value, int $flags = 0, int $expiration = 0): Awaitable<void>
Store a value -
->set(string $key, string $value, int $flags = 0, int $expiration = 0): Awaitable<void>
Store a value (replacing if present) -
->version(): Awaitable<string>
Get the remote server's current version