set method

  1. @override
Future<bool> set(
  1. K key,
  2. V value
)
override

SET command (set value)

Implementation

@override
Future<bool> set(K key, V value) async {
  final keyString = keyCodec.encode<K>(key);
  final valueString = valueCodec.encode<V>(value);
  _connection.sendCommand(Resp(['SET', keyString, valueString]));
  final res = await _connection.receive();
  res.throwIfError();

  final s = res.stringValue;
  if (s == null) {
    return false;
  }
  return s == 'OK';
}