setAll method

Future<void> setAll(
  1. Map<String, Object?> entries, {
  2. Duration? ttl,
})

Stores several entries with one disk write.

Implementation

Future<void> setAll(Map<String, Object?> entries, {Duration? ttl}) {
  final int? expiresAt = ttl == null ? null : DateTime.now().add(ttl).millisecondsSinceEpoch;
  for (final MapEntry<String, Object?> e in entries.entries) {
    if (e.value == null) {
      _delete(e.key);
    } else {
      _put(e.key, e.value!, expiresAt);
    }
  }
  return _schedule();
}