jsonArrAppend method

Future<int> jsonArrAppend(
  1. String key,
  2. Object value, {
  3. String path = '\$',
})

------------------------------ json ------------------------------ https://redis.io/docs/latest/develop/data-types/json/ jsonArrAppend

Implementation

/// jsonArrAppend
Future<int> jsonArrAppend(String key, Object value,
    {String path = '\$'}) async {
  List<RespType<dynamic>>? result = await _runWithRetryNew(() async {
    return (await RespCommandsTier1(_client!)
            .jsonArrAppend(key: key, path: path, value: value))
        .toArray()
        .payload;
  });

  if (result != null && result.isNotEmpty) {
    return result[0].payload as int; // 确保 payload 是 int 类型
  } else {
    throw Exception('jsonArrAppend: No elements in the result list');
  }
}