Tingle.Extensions.Processing
4.11.0
See the version list below for details.
dotnet add package Tingle.Extensions.Processing --version 4.11.0
NuGet\Install-Package Tingle.Extensions.Processing -Version 4.11.0
<PackageReference Include="Tingle.Extensions.Processing" Version="4.11.0" />
paket add Tingle.Extensions.Processing --version 4.11.0
#r "nuget: Tingle.Extensions.Processing, 4.11.0"
// Install Tingle.Extensions.Processing as a Cake Addin #addin nuget:?package=Tingle.Extensions.Processing&version=4.11.0 // Install Tingle.Extensions.Processing as a Cake Tool #tool nuget:?package=Tingle.Extensions.Processing&version=4.11.0
Tingle.Extensions.Processing
This library provides various processing functionalities that are commonly encountered by developers.
The various functionalities will be described using examples below.
Sequential Batch Processing
There are scenarios when we need to do some sort of processing of items in an IEnumerable
but wish to do so in a parallel fashion without splitting up the items to ensure processing order of items is guaranteed.
Let us look at an example of how we can help to accomplish this.
First let us define a function that will be used to handle the processing of a variable of type string
. The type to be processed can be any .NET type.
Task DoStuffAsync(string token, CancellationToken ct)
{
// Do your processing here...
return Task.CompletedTask;
}
Let us now define a list of strings that require to be processed
var tokens = new List<string> { "value_1", "value_2", "value_3"};
Now let us tie it all up together to show how we can process tokens
sequentially.
var processor = new SequentialBatchProcessor<string>(concurrencyLimit: 1, handler: (t, ct) => DoStuffAsync(token: t, ct: ct));
await processor.ProcessAsync(tokens, cancellationToken);
Therefore, we can process the tokens
sequentially. By default, SequentialBatchProcessor<T>
's constructor has the concurrency limit set to 1. If you wish to increase the number of items handled concurrently, you can increase this limit to a higher value.
Split and Batch Processing
With this functionality, you can split a list of items and then process the splits in parallel. For example, a list of 2,000 items with a batch size of 100 to produce 20 batches which would be processed in parallel. However, unlike the Sequential Batch Processing described above, the processing order isn't guaranteed.
Using the previously defined tokens
variable let us see how we can accomplish this:
First define a function that can process a list of items.
Task DoBulkStuffAsync(List<string> tokens, CancellationToken ct)
{
// Do your processing here...
return Task.CompletedTask;
}
var processor = new SplitAndBatchProcessor<string>(batchSize: 10, handler: (slice, ct) => DoBulkStuffAsync(slice, ct));
await processor.ProcessAsync(items: tokens, cancellationToken);
The list of tokens
will be split into batches of 10 and then the slices will be processed in parallel. The batch size is set to 10 by default, but a developer can change this to suit their own specific requirements.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.0.0 | 95 | 11/19/2024 |
4.14.1 | 299 | 10/14/2024 |
4.14.0 | 357 | 9/16/2024 |
4.13.0 | 603 | 8/13/2024 |
4.12.0 | 166 | 8/7/2024 |
4.11.2 | 313 | 7/15/2024 |
4.11.1 | 367 | 6/26/2024 |
4.11.0 | 306 | 6/6/2024 |
4.10.1 | 106 | 6/5/2024 |
4.10.0 | 194 | 5/27/2024 |
4.9.0 | 308 | 5/16/2024 |
4.8.0 | 353 | 5/5/2024 |
4.7.0 | 370 | 3/25/2024 |
4.6.0 | 309 | 3/8/2024 |
4.5.0 | 1,070 | 11/22/2023 |
4.4.1 | 242 | 11/20/2023 |
4.4.0 | 190 | 11/15/2023 |
4.3.0 | 450 | 10/18/2023 |
4.2.2 | 471 | 9/20/2023 |
4.2.1 | 623 | 8/4/2023 |
4.2.0 | 839 | 5/31/2023 |
4.1.1 | 200 | 5/26/2023 |
4.1.0 | 244 | 5/22/2023 |
4.0.0 | 1,467 | 3/14/2023 |
3.8.1 | 2,320 | 11/30/2022 |
3.8.0 | 547 | 11/21/2022 |
3.7.0 | 2,981 | 9/4/2022 |
3.6.0 | 2,424 | 7/4/2022 |
3.5.3 | 2,929 | 4/8/2022 |
3.5.2 | 2,193 | 1/7/2022 |
3.5.1 | 2,027 | 11/11/2021 |
3.5.0 | 662 | 11/10/2021 |
3.4.7 | 1,059 | 11/2/2021 |
3.4.6 | 596 | 10/29/2021 |
3.4.5 | 1,554 | 10/9/2021 |
3.4.4 | 1,669 | 8/9/2021 |
3.4.3 | 304 | 8/9/2021 |
3.4.2 | 1,439 | 5/26/2021 |
0.1.0-ci0015 | 212 | 5/26/2021 |