Soenneker.Utils.RateLimiting.Factory 3.0.112

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Utils.RateLimiting.Factory --version 3.0.112                
NuGet\Install-Package Soenneker.Utils.RateLimiting.Factory -Version 3.0.112                
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="3.0.112" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.RateLimiting.Factory --version 3.0.112                
#r "nuget: Soenneker.Utils.RateLimiting.Factory, 3.0.112"                
#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=3.0.112

// Install Soenneker.Utils.RateLimiting.Factory as a Cake Tool
#tool nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=3.0.112                

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image 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

  1. Register IRateLimitingFactory within DI (Program.cs).
public static async Task Main(string[] args)
{
    ...
    builder.Services.AddRateLimitingFactoryAsSingleton();
}
  1. Inject IRateLimitingFactory, and retrieve a RateLimitingFactory.

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 Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
3.0.113 43 11/21/2024
3.0.112 45 11/21/2024
3.0.111 35 11/21/2024
3.0.110 39 11/21/2024
3.0.109 52 11/21/2024
3.0.108 35 11/21/2024
3.0.107 88 11/20/2024
3.0.106 43 11/20/2024
3.0.105 36 11/20/2024
3.0.104 74 11/20/2024
3.0.103 65 11/20/2024
3.0.102 59 11/20/2024
3.0.101 65 11/20/2024
3.0.100 64 11/19/2024
3.0.99 64 11/19/2024
3.0.98 58 11/19/2024
3.0.97 215 11/19/2024
3.0.96 123 11/19/2024
3.0.95 59 11/19/2024
3.0.94 59 11/19/2024
3.0.93 121 11/19/2024
3.0.92 57 11/19/2024
3.0.91 87 11/19/2024
3.0.90 65 11/19/2024
3.0.89 204 11/15/2024
3.0.88 91 11/15/2024
3.0.87 60 11/15/2024
3.0.86 67 11/14/2024
3.0.85 58 11/14/2024
3.0.84 105 11/14/2024
3.0.83 61 11/14/2024
3.0.82 68 11/14/2024
3.0.81 63 11/14/2024
3.0.80 112 11/14/2024
3.0.79 110 11/14/2024
3.0.78 72 11/14/2024
3.0.77 63 11/14/2024
3.0.76 153 11/14/2024
3.0.75 68 11/14/2024
3.0.74 107 11/14/2024
3.0.73 144 11/14/2024
3.0.72 67 11/14/2024
3.0.71 120 11/14/2024
3.0.70 62 11/14/2024
3.0.69 86 11/14/2024
3.0.68 73 11/14/2024
3.0.67 157 11/14/2024
3.0.66 65 11/14/2024
3.0.65 66 11/14/2024
2.1.64 245 11/13/2024
2.1.63 83 11/13/2024
2.1.62 88 11/13/2024
2.1.61 61 11/13/2024
2.1.60 56 11/13/2024
2.1.59 200 11/13/2024
2.1.58 63 11/13/2024
2.1.57 65 11/13/2024
2.1.56 98 11/12/2024
2.1.55 59 11/12/2024
2.1.54 424 11/9/2024
2.1.53 97 11/9/2024
2.1.52 72 11/9/2024
2.1.51 117 11/9/2024
2.1.50 75 11/9/2024
2.1.49 73 11/9/2024
2.1.48 74 11/9/2024
2.1.47 205 11/9/2024
2.1.46 188 11/8/2024
2.1.45 74 11/8/2024
2.1.44 82 11/8/2024
2.1.43 98 11/8/2024
2.1.42 78 11/8/2024
2.1.41 189 11/8/2024
2.1.40 74 11/8/2024
2.1.39 71 11/8/2024
2.1.38 165 11/8/2024
2.1.37 69 11/8/2024
2.1.36 228 11/6/2024
2.1.35 116 11/6/2024
2.1.34 254 11/1/2024
2.1.33 101 11/1/2024
2.1.32 73 11/1/2024
2.1.31 100 11/1/2024
2.1.30 132 11/1/2024
2.1.29 131 11/1/2024
2.1.28 75 11/1/2024
2.1.26 199 10/29/2024
2.1.25 68 10/29/2024
2.1.24 65 10/29/2024
2.1.23 78 10/29/2024
2.1.22 73 10/29/2024
2.1.21 67 10/29/2024
2.1.20 205 10/29/2024
2.1.19 175 10/29/2024
2.1.18 108 10/29/2024
2.1.17 73 10/29/2024
2.1.16 64 10/29/2024
2.1.15 190 10/28/2024
2.1.14 72 10/28/2024
2.1.13 66 10/28/2024
2.1.12 295 10/26/2024
2.1.11 70 10/26/2024
2.1.10 72 10/26/2024
2.1.9 65 10/26/2024
2.1.8 68 10/26/2024
2.1.7 65 10/26/2024
2.1.6 193 10/22/2024
2.1.5 73 10/22/2024
2.1.4 71 10/22/2024
2.1.3 74 10/22/2024
2.1.2 75 10/22/2024
2.1.1 73 10/22/2024