hgetall method

Future<Map<String, String?>> hgetall(
  1. String key
)

hgetall

Implementation

Future<Map<String, String?>> hgetall(String key) async {
  return await _runWithRetryNew(() async {
    final result =
        (await RespCommandsTier1(_client!).hgetall(key)).toArray().payload;
    final map = <String, String?>{};
    if (result != null) {
      for (var i = 0; i < result.length; i += 2) {
        final key = result[i].toBulkString().payload;
        final value = result[i + 1].toBulkString().payload;
        if (key != null) {
          map[key] = value;
        }
      }
    }
    return map;
  });
}