hExpireTime method

Future<List<int>> hExpireTime(
  1. String key,
  2. List<String> fields
)

HEXPIRETIME key FIELDS numfields field field ...

Returns the absolute Unix timestamp (in seconds) at which the given fields will expire.

Returns a list of integers for each field:

  • -1 if the field exists but has no associated expiration.
  • -2 if the field does not exist.
  • The Unix timestamp for the field's expiration.

Implementation

Future<List<int>> hExpireTime(String key, List<String> fields) async {
  if (fields.isEmpty) return [];

  final cmd = <String>[
    'HEXPIRETIME',
    key,
    'FIELDS',
    fields.length.toString(),
    ...fields
  ];

  final result = await execute(cmd);

  if (result is List) {
    return result.map((e) => e as int).toList();
  }
  return [];
}