Soenneker.Utils.RateLimiting.Factory
2.1.11
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Soenneker.Utils.RateLimiting.Factory --version 2.1.11
NuGet\Install-Package Soenneker.Utils.RateLimiting.Factory -Version 2.1.11
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Utils.RateLimiting.Factory" Version="2.1.11" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.RateLimiting.Factory --version 2.1.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Utils.RateLimiting.Factory, 2.1.11"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Soenneker.Utils.RateLimiting.Factory as a Cake Addin #addin nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=2.1.11 // Install Soenneker.Utils.RateLimiting.Factory as a Cake Tool #tool nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=2.1.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Utils.RateLimiting.Factory
An async thread-safe singleton dictionary for Soenneker.Utils.RateLimiting.Executors, designed to manage the rate at which tasks are executed.
Installation
dotnet add package Soenneker.Utils.RateLimiting.Factory
Usage
- Register
IRateLimitingFactory
within DI (Program.cs
).
public static async Task Main(string[] args)
{
...
builder.Services.AddRateLimitingFactoryAsSingleton();
}
- Inject
IRateLimitingFactory
, and retrieve aRateLimitingFactory
.
Example:
public class TestClass
{
IRateLimitingFactory _factory;
public TestClass(IRateLimitingFactory factory)
{
_factory = factory;
}
public async ValueTask ExecuteTasks()
{
RateLimitingExecutor rateLimitingExecutor = await _factory.Get("test", TimeSpan.FromSeconds(2));
for (int i = 0; i < 5; i++)
{
await rateLimitingExecutor.Execute(async ct =>
{
Logger.LogInformation($"Executing Task {i + 1} at {DateTime.Now:HH:mm:ss}");
await Task.Delay(100, ct); // Simulate some work
});
}
}
}
Console Output
Executing Task 1 at 14:00:00
Executing Task 2 at 14:00:02
Executing Task 3 at 14:00:04
Executing Task 4 at 14:00:06
Executing Task 5 at 14:00:08
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Soenneker.Utils.RateLimiting.Executor (>= 2.1.7)
- Soenneker.Utils.SingletonDictionary (>= 2.1.533)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Utils.RateLimiting.Factory:
Package | Downloads |
---|---|
Soenneker.Validators.Yahoo.Exists
A validation module checking for Yahoo account existence |
|
Soenneker.Validators.Gmail.Exists
A validation module checking for Gmail account existence |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.38 | 0 | 11/8/2024 |
2.1.37 | 0 | 11/8/2024 |
2.1.36 | 78 | 11/6/2024 |
2.1.35 | 70 | 11/6/2024 |
2.1.34 | 218 | 11/1/2024 |
2.1.33 | 92 | 11/1/2024 |
2.1.32 | 66 | 11/1/2024 |
2.1.31 | 91 | 11/1/2024 |
2.1.30 | 126 | 11/1/2024 |
2.1.29 | 124 | 11/1/2024 |
2.1.28 | 68 | 11/1/2024 |
2.1.26 | 193 | 10/29/2024 |
2.1.25 | 62 | 10/29/2024 |
2.1.24 | 58 | 10/29/2024 |
2.1.23 | 72 | 10/29/2024 |
2.1.22 | 67 | 10/29/2024 |
2.1.21 | 61 | 10/29/2024 |
2.1.20 | 198 | 10/29/2024 |
2.1.19 | 168 | 10/29/2024 |
2.1.18 | 101 | 10/29/2024 |
2.1.17 | 66 | 10/29/2024 |
2.1.16 | 57 | 10/29/2024 |
2.1.15 | 183 | 10/28/2024 |
2.1.14 | 65 | 10/28/2024 |
2.1.13 | 60 | 10/28/2024 |
2.1.12 | 289 | 10/26/2024 |
2.1.11 | 64 | 10/26/2024 |
2.1.10 | 66 | 10/26/2024 |
2.1.9 | 59 | 10/26/2024 |
2.1.8 | 63 | 10/26/2024 |
2.1.7 | 59 | 10/26/2024 |
2.1.6 | 186 | 10/22/2024 |
2.1.5 | 64 | 10/22/2024 |
2.1.4 | 64 | 10/22/2024 |
2.1.3 | 67 | 10/22/2024 |
2.1.2 | 66 | 10/22/2024 |
2.1.1 | 68 | 10/22/2024 |