incr method

Future<int> incr(
  1. String key
)

INCR key

Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.

Complexity: O(1)

Returns:

  • int: The value of key after the increment.

Implementation

Future<int> incr(String key) async {
  final cmd = <String>['INCR', key];
  return executeInt(cmd);
}