bulkDelete method
Implementation
Future<void> bulkDelete(List<String> ids, {int chunkSize = 500}) async {
for (final id in ids) {
final blockId = '$_name/$id';
_pendingTags.remove(blockId);
_invalidateQueryCacheFor(blockId);
await _cacheEvict(blockId);
}
if (_local) return;
if (!_ws.isConnected && _smartCache != null) {
for (final id in ids) {
await _smartCache.enqueueDelete('$_name/$id');
}
return;
}
try {
for (var i = 0; i < ids.length; i += chunkSize) {
final end = math.min(i + chunkSize, ids.length);
final blockIds = ids.sublist(i, end).map((id) => '$_name/$id').toList();
await _ws.bulkDelete(blockIds);
}
} catch (e) {
if (e is WsDeniedException) rethrow;
if (_smartCache != null) {
for (final id in ids) {
await _smartCache.enqueueDelete('$_name/$id');
}
}
}
}