Soenneker.Utils.RateLimiting.Factory 3.0.123

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.123                
NuGet\Install-Package Soenneker.Utils.RateLimiting.Factory -Version 3.0.123                
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.123" />                
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.123                
#r "nuget: Soenneker.Utils.RateLimiting.Factory, 3.0.123"                
#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.123

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

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.137 0 12/2/2024
3.0.136 0 12/2/2024
3.0.135 0 12/2/2024
3.0.134 0 12/2/2024
3.0.133 0 12/2/2024
3.0.132 0 12/2/2024
3.0.131 0 12/2/2024
3.0.130 0 12/2/2024
3.0.129 0 12/2/2024
3.0.128 3 12/1/2024
3.0.127 6 12/1/2024
3.0.126 27 12/1/2024
3.0.125 23 12/1/2024
3.0.124 62 12/1/2024
3.0.123 36 12/1/2024
3.0.122 33 12/1/2024
3.0.121 30 12/1/2024
3.0.120 78 11/29/2024
3.0.119 42 11/29/2024
3.0.118 36 11/29/2024
3.0.117 59 11/29/2024
3.0.116 37 11/29/2024
3.0.115 49 11/29/2024
3.0.114 49 11/29/2024
3.0.113 117 11/21/2024
3.0.112 90 11/21/2024
3.0.111 68 11/21/2024
3.0.110 74 11/21/2024
3.0.109 100 11/21/2024
3.0.108 79 11/21/2024
3.0.107 174 11/20/2024
3.0.106 84 11/20/2024
3.0.105 74 11/20/2024
3.0.104 93 11/20/2024
3.0.103 73 11/20/2024
3.0.102 68 11/20/2024
3.0.101 73 11/20/2024
3.0.100 72 11/19/2024
3.0.99 72 11/19/2024
3.0.98 66 11/19/2024
3.0.97 335 11/19/2024
3.0.96 197 11/19/2024
3.0.95 63 11/19/2024
3.0.94 63 11/19/2024
3.0.93 136 11/19/2024
3.0.92 61 11/19/2024
3.0.91 91 11/19/2024
3.0.90 69 11/19/2024
3.0.89 217 11/15/2024
3.0.88 95 11/15/2024
3.0.87 64 11/15/2024
3.0.86 71 11/14/2024
3.0.85 62 11/14/2024
3.0.84 109 11/14/2024
3.0.83 65 11/14/2024
3.0.82 72 11/14/2024
3.0.81 67 11/14/2024
3.0.80 116 11/14/2024
3.0.79 114 11/14/2024
3.0.78 76 11/14/2024
3.0.77 67 11/14/2024
3.0.76 157 11/14/2024
3.0.75 72 11/14/2024
3.0.74 111 11/14/2024
3.0.73 148 11/14/2024
3.0.72 71 11/14/2024
3.0.71 124 11/14/2024
3.0.70 66 11/14/2024
3.0.69 90 11/14/2024
3.0.68 77 11/14/2024
3.0.67 161 11/14/2024
3.0.66 69 11/14/2024
3.0.65 70 11/14/2024
2.1.64 249 11/13/2024
2.1.63 87 11/13/2024
2.1.62 92 11/13/2024
2.1.61 69 11/13/2024
2.1.60 64 11/13/2024
2.1.59 208 11/13/2024
2.1.58 71 11/13/2024
2.1.57 73 11/13/2024
2.1.56 106 11/12/2024
2.1.55 67 11/12/2024
2.1.54 489 11/9/2024
2.1.53 101 11/9/2024
2.1.52 76 11/9/2024
2.1.51 121 11/9/2024
2.1.50 79 11/9/2024
2.1.49 77 11/9/2024
2.1.48 78 11/9/2024
2.1.47 209 11/9/2024
2.1.46 192 11/8/2024
2.1.45 78 11/8/2024
2.1.44 86 11/8/2024
2.1.43 102 11/8/2024
2.1.42 82 11/8/2024
2.1.41 193 11/8/2024
2.1.40 78 11/8/2024
2.1.39 75 11/8/2024
2.1.38 169 11/8/2024
2.1.37 73 11/8/2024
2.1.36 232 11/6/2024
2.1.35 120 11/6/2024
2.1.34 259 11/1/2024
2.1.33 106 11/1/2024
2.1.32 78 11/1/2024
2.1.31 105 11/1/2024
2.1.30 137 11/1/2024
2.1.29 136 11/1/2024
2.1.28 80 11/1/2024
2.1.26 202 10/29/2024
2.1.25 71 10/29/2024
2.1.24 68 10/29/2024
2.1.23 81 10/29/2024
2.1.22 76 10/29/2024
2.1.21 70 10/29/2024
2.1.20 208 10/29/2024
2.1.19 178 10/29/2024
2.1.18 111 10/29/2024
2.1.17 76 10/29/2024
2.1.16 67 10/29/2024
2.1.15 193 10/28/2024
2.1.14 75 10/28/2024
2.1.13 69 10/28/2024
2.1.12 298 10/26/2024
2.1.11 73 10/26/2024
2.1.10 75 10/26/2024
2.1.9 68 10/26/2024
2.1.8 71 10/26/2024
2.1.7 68 10/26/2024
2.1.6 196 10/22/2024
2.1.5 75 10/22/2024
2.1.4 73 10/22/2024
2.1.3 76 10/22/2024
2.1.2 77 10/22/2024
2.1.1 75 10/22/2024