add method

Future<bool> add (String key, String value, { int expired: 0 })

add item to cache; expired: hours defaults to 0

Implementation

static Future<bool> add(String key, String value, {int expired = 0}) async {
  MmkvFlutter mmkv = await MmkvFlutter.getInstance();
  final timespan =
      DateTime.now().add(new Duration(hours: expired)).millisecondsSinceEpoch;

  /// add timespan to value so we can use it later.
  final v = '$timespan:$value';
  return mmkv.setString(_getPrefix(key), v);
}