createEntryForBulk method

  1. @override
Future<void> createEntryForBulk(
  1. Map<String, String> cachedFilePaths
)
override

Creates entries for the given cached file paths in bulk.

Implementation

@override
Future<void> createEntryForBulk(Map<String, String> cachedFilePaths) async {
  final transaction = await _command.multi();
  final futures = <Future<dynamic>>[];

  for (final cache in cachedFilePaths.entries) {
    futures.add(transaction.set(cache.key, cache.value));
  }

  final response = await transaction.exec();
  if (response.toString() == 'OK') {
    await Future.wait(futures);
  } else {
    throw Exception('$_tag: createEntryForBulk: Redis Error $response');
  }
}