TaskMuxer 1.0.1
See the version list below for details.
dotnet add package TaskMuxer --version 1.0.1
NuGet\Install-Package TaskMuxer -Version 1.0.1
<PackageReference Include="TaskMuxer" Version="1.0.1" />
<PackageVersion Include="TaskMuxer" Version="1.0.1" />
<PackageReference Include="TaskMuxer" />
paket add TaskMuxer --version 1.0.1
#r "nuget: TaskMuxer, 1.0.1"
#:package TaskMuxer@1.0.1
#addin nuget:?package=TaskMuxer&version=1.0.1
#tool nuget:?package=TaskMuxer&version=1.0.1
TaskMuxer
Task Multiplexer.
The purpose of this package is to provide the ability to reduce the amount of parallel repetitive work.
In practical terms, imagine a service that requests data from a slow external API serving multiple requests in parallel.
By using this library, for any number of parallel requests only one will be executed.
Tasks are being identified / segmented by a key and their respective return type.
Usage
Registration
Locate the services registration and append one of:
.AddInstanceTaskMultiplexerNoLogger
- use when no logging is required.AddInstanceTaskMultiplexerWithILogger
- use when the ILogger provider is available.AddInstanceTaskMultiplexerWithILoggerFactory
- use when the ILoggerFactory provider is available
ex.
// Startup.cs
public void ConfigureServices(IServiceCollection services)
{
// ...
services
.AddInstanceTaskMultiplexerWithILogger();
// ...
}
📝 If further customization is required, consider wiring up any of the ITaskMultiplexer
implementations as required.
Code
Please check the ITaskMultiplexer
interface for the API surface provided.
ex.
public class ItemsCountService
{
readonly ITaskMultiplexer _taskMultiplexer;
public ItemsCountService(ITaskMultiplexer taskMultiplexer) => _taskMultiplexer = taskMultiplexer;
public async Task<long> GetCountOfItems(CancellationToken cancellationToken = default) =>
await _taskMultiplexer.AddTask(
"items_count",
async ct =>
{
await Task.Delay(250, ct);
return Random.Shared.Next();
},
cancellationToken
);
}
Similar Projects
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Logging (>= 7.0.0)
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 |
---|---|---|
2.1.1 | 268 | 11/16/2024 |
2.1.0 | 125 | 11/16/2024 |
2.0.1 | 5,174 | 11/22/2023 |
2.0.0 | 133 | 11/21/2023 |
1.0.13 | 1,950 | 9/15/2023 |
1.0.12 | 187 | 9/14/2023 |
1.0.11 | 422 | 9/13/2023 |
1.0.10 | 247 | 9/11/2023 |
1.0.9 | 196 | 9/10/2023 |
1.0.8 | 158 | 9/4/2023 |
1.0.7 | 180 | 9/1/2023 |
1.0.6 | 182 | 9/1/2023 |
1.0.5 | 190 | 8/31/2023 |
1.0.4 | 185 | 8/30/2023 |
1.0.3 | 192 | 8/28/2023 |
1.0.2 | 193 | 8/28/2023 |
1.0.1 | 199 | 8/27/2023 |
1.0.0 | 182 | 8/26/2023 |