Soenneker.Utils.RateLimiting.Factory 3.0.153

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

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

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.165 0 12/4/2024
3.0.164 0 12/4/2024
3.0.163 0 12/4/2024
3.0.162 0 12/4/2024
3.0.161 0 12/4/2024
3.0.160 0 12/4/2024
3.0.159 0 12/4/2024
3.0.158 20 12/4/2024
3.0.157 24 12/4/2024
3.0.156 20 12/4/2024
3.0.155 51 12/4/2024
3.0.154 34 12/3/2024
3.0.153 27 12/3/2024
3.0.152 48 12/3/2024
3.0.151 29 12/3/2024
3.0.150 53 12/3/2024
3.0.149 34 12/3/2024
3.0.148 39 12/3/2024
3.0.147 35 12/3/2024
3.0.146 74 12/3/2024
3.0.145 30 12/3/2024
3.0.144 32 12/3/2024
3.0.143 78 12/3/2024
3.0.142 31 12/3/2024
3.0.141 251 12/2/2024
3.0.140 30 12/2/2024
3.0.139 32 12/2/2024
3.0.138 26 12/2/2024
3.0.137 84 12/2/2024
3.0.136 34 12/2/2024
3.0.135 38 12/2/2024
3.0.134 85 12/2/2024
3.0.133 30 12/2/2024
3.0.132 92 12/2/2024
3.0.131 33 12/2/2024
3.0.130 132 12/2/2024
3.0.129 32 12/2/2024
3.0.128 33 12/1/2024
3.0.127 36 12/1/2024
3.0.126 76 12/1/2024
3.0.125 35 12/1/2024
3.0.124 134 12/1/2024
3.0.123 52 12/1/2024
3.0.122 40 12/1/2024
3.0.121 36 12/1/2024
3.0.120 138 11/29/2024
3.0.119 58 11/29/2024
3.0.118 38 11/29/2024
3.0.117 89 11/29/2024
3.0.116 39 11/29/2024
3.0.115 66 11/29/2024
3.0.114 62 11/29/2024
3.0.113 151 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 219 11/15/2024
3.0.88 97 11/15/2024
3.0.87 66 11/15/2024
3.0.86 73 11/14/2024
3.0.85 64 11/14/2024
3.0.84 111 11/14/2024
3.0.83 67 11/14/2024
3.0.82 74 11/14/2024
3.0.81 69 11/14/2024
3.0.80 118 11/14/2024
3.0.79 116 11/14/2024
3.0.78 78 11/14/2024
3.0.77 69 11/14/2024
3.0.76 159 11/14/2024
3.0.75 74 11/14/2024
3.0.74 113 11/14/2024
3.0.73 150 11/14/2024
3.0.72 73 11/14/2024
3.0.71 126 11/14/2024
3.0.70 68 11/14/2024
3.0.69 92 11/14/2024
3.0.68 79 11/14/2024
3.0.67 163 11/14/2024
3.0.66 71 11/14/2024
3.0.65 72 11/14/2024
2.1.64 255 11/13/2024
2.1.63 91 11/13/2024
2.1.62 98 11/13/2024
2.1.61 71 11/13/2024
2.1.60 66 11/13/2024
2.1.59 210 11/13/2024
2.1.58 73 11/13/2024
2.1.57 75 11/13/2024
2.1.56 108 11/12/2024
2.1.55 69 11/12/2024
2.1.54 491 11/9/2024
2.1.53 103 11/9/2024
2.1.52 78 11/9/2024
2.1.51 123 11/9/2024
2.1.50 81 11/9/2024
2.1.49 79 11/9/2024
2.1.48 80 11/9/2024
2.1.47 211 11/9/2024
2.1.46 194 11/8/2024
2.1.45 80 11/8/2024
2.1.44 88 11/8/2024
2.1.43 104 11/8/2024
2.1.42 84 11/8/2024
2.1.41 195 11/8/2024
2.1.40 80 11/8/2024
2.1.39 78 11/8/2024
2.1.38 172 11/8/2024
2.1.37 76 11/8/2024
2.1.36 235 11/6/2024
2.1.35 123 11/6/2024
2.1.34 262 11/1/2024
2.1.33 109 11/1/2024
2.1.32 81 11/1/2024
2.1.31 108 11/1/2024
2.1.30 140 11/1/2024
2.1.29 139 11/1/2024
2.1.28 83 11/1/2024
2.1.26 204 10/29/2024
2.1.25 73 10/29/2024
2.1.24 70 10/29/2024
2.1.23 83 10/29/2024
2.1.22 78 10/29/2024
2.1.21 72 10/29/2024
2.1.20 210 10/29/2024
2.1.19 180 10/29/2024
2.1.18 113 10/29/2024
2.1.17 78 10/29/2024
2.1.16 69 10/29/2024
2.1.15 195 10/28/2024
2.1.14 77 10/28/2024
2.1.13 71 10/28/2024
2.1.12 300 10/26/2024
2.1.11 75 10/26/2024
2.1.10 77 10/26/2024
2.1.9 70 10/26/2024
2.1.8 73 10/26/2024
2.1.7 70 10/26/2024
2.1.6 198 10/22/2024
2.1.5 77 10/22/2024
2.1.4 75 10/22/2024
2.1.3 78 10/22/2024
2.1.2 79 10/22/2024
2.1.1 77 10/22/2024