putAll method

  1. @override
Future<void> putAll(
  1. Map<String, CacheItem> entries
)
override

Stores multiple values in the cache with the given keys.

Each value is wrapped in a CacheItem object, which allows for optional expiry.

Throws a CacheException if there is an error storing the data.

Implementation

@override
Future<void> putAll(Map<String, CacheItem<dynamic>> entries) async {
  for (final entry in entries.entries) {
    if (enableEncryption) {
      final encryptedValue = _encrypt(jsonEncode(entry.value.toJson()));
      _cache[entry.key] = encryptedValue;
    } else {
      _cache[entry.key] = entry.value;
    }
  }
}