getAnyReplica method

Future<GetReplicaResult> getAnyReplica(
  1. String key, [
  2. GetAnyReplicaOptions? options
])

Retrieves the value of the document from any of the available replicas.

This will return as soon as the first response is received from any replica node.

Implementation

Future<GetReplicaResult> getAnyReplica(
  String key, [
  GetAnyReplicaOptions? options,
]) async {
  options ??= const GetAnyReplicaOptions();

  final response = await _connection.getAnyReplica(
    GetAnyReplicaRequest(
      id: _documentId(key),
      timeout: _kvTimeout(options),
    ),
  );

  return GetReplicaResult(
    content: _decodeDocument(options, response.flags, response.value),
    cas: response.cas,
    isReplica: response.replica,
  );
}