increment method

  1. @override
Future<int> increment(
  1. String key, [
  2. int value = 1
])
override

Increments the value of an item in the cache.

Implementation

@override
Future<int> increment(String key, [int value = 1]) async {
  final cmd = await _getCommand();
  if (value == 1) {
    final res = await cmd.send_object(['INCR', key]);
    return res is int ? res : int.parse(res.toString());
  }
  final res = await cmd.send_object(['INCRBY', key, value]);
  return res is int ? res : int.parse(res.toString());
}