set method

Future<SetResult> set(
  1. String key,
  2. Object value, {
  3. ExpireMode? expire,
  4. SetMode? mode,
  5. bool get = false,
})

Sets a value for the given key.

Returns a SetResult.

Implementation

Future<SetResult> set(String key, Object value, {ExpireMode? expire, SetMode? mode, bool get = false}) async {
  final result = (await tier1.set(key, value, expire: expire, mode: mode, get: get));
  return result.handleAs<SetResult>(
    simple: (_) => SetResult._(true, null),
    bulk: (type) => SetResult._(type.payload != null, type.payload),
    error: (_) => SetResult._(false, null),
  );
}