scan method

Future<ScanResult> scan(
  1. int cursor, {
  2. String? pattern,
  3. int? count,
})

The SCAN command and the closely related commands SSCAN, HSCAN and ZSCAN are used in order to incrementally iterate over a collection of elements.

See https://redis.io/commands/scan for more detailed documentation.

Implementation

Future<ScanResult> scan(int cursor, {String? pattern, int? count}) async {
  final result = _getArray(await _execCmd([
    'SCAN',
    '$cursor',
    if (pattern != null) ...['MATCH', pattern],
    if (count != null) ...['COUNT', count],
  ]));
  return ScanResult._(result);
}