Soenneker.Utils.RateLimiting.Factory 3.0.190

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

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

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.227 5 12/17/2024
3.0.225 49 12/17/2024
3.0.224 69 12/17/2024
3.0.223 49 12/16/2024
3.0.222 31 12/16/2024
3.0.221 40 12/16/2024
3.0.220 38 12/16/2024
3.0.219 202 12/10/2024
3.0.218 61 12/10/2024
3.0.217 87 12/10/2024
3.0.216 74 12/10/2024
3.0.215 112 12/10/2024
3.0.214 68 12/10/2024
3.0.213 82 12/9/2024
3.0.212 81 12/9/2024
3.0.211 114 12/9/2024
3.0.210 153 12/9/2024
3.0.209 70 12/9/2024
3.0.208 77 12/9/2024
3.0.207 64 12/9/2024
3.0.206 68 12/9/2024
3.0.205 118 12/9/2024
3.0.204 64 12/9/2024
3.0.203 189 12/7/2024
3.0.202 79 12/7/2024
3.0.201 71 12/7/2024
3.0.200 68 12/6/2024
3.0.199 65 12/6/2024
3.0.198 79 12/6/2024
3.0.197 72 12/6/2024
3.0.196 74 12/6/2024
3.0.195 74 12/6/2024
3.0.194 76 12/6/2024
3.0.193 69 12/6/2024
3.0.192 76 12/6/2024
3.0.191 82 12/6/2024
3.0.190 77 12/6/2024
3.0.189 80 12/6/2024
3.0.188 78 12/6/2024
3.0.187 93 12/6/2024
3.0.184 86 12/6/2024
3.0.183 74 12/6/2024
3.0.182 71 12/6/2024
3.0.181 84 12/5/2024
3.0.180 80 12/5/2024
3.0.179 75 12/5/2024
3.0.178 627 12/5/2024
3.0.177 87 12/5/2024
3.0.176 75 12/5/2024
3.0.175 98 12/5/2024
3.0.174 65 12/5/2024
3.0.173 92 12/5/2024
3.0.172 113 12/5/2024
3.0.171 70 12/5/2024
3.0.170 105 12/5/2024
3.0.169 75 12/5/2024
3.0.168 81 12/5/2024
3.0.167 72 12/4/2024
3.0.166 73 12/4/2024
3.0.165 123 12/4/2024
3.0.164 74 12/4/2024
3.0.163 160 12/4/2024
3.0.162 104 12/4/2024
3.0.161 80 12/4/2024
3.0.160 109 12/4/2024
3.0.159 72 12/4/2024
3.0.158 128 12/4/2024
3.0.157 71 12/4/2024
3.0.156 68 12/4/2024
3.0.155 148 12/4/2024
3.0.154 71 12/3/2024
3.0.153 66 12/3/2024
3.0.152 108 12/3/2024
3.0.151 63 12/3/2024
3.0.150 98 12/3/2024
3.0.149 68 12/3/2024
3.0.148 71 12/3/2024
3.0.147 68 12/3/2024
3.0.146 115 12/3/2024
3.0.145 64 12/3/2024
3.0.144 75 12/3/2024
3.0.143 114 12/3/2024
3.0.142 68 12/3/2024
3.0.141 310 12/2/2024
3.0.140 74 12/2/2024
3.0.139 68 12/2/2024
3.0.138 59 12/2/2024
3.0.137 118 12/2/2024
3.0.136 78 12/2/2024
3.0.135 72 12/2/2024
3.0.134 127 12/2/2024
3.0.133 67 12/2/2024
3.0.132 129 12/2/2024
3.0.131 69 12/2/2024
3.0.130 170 12/2/2024
3.0.129 68 12/2/2024
3.0.128 70 12/1/2024
3.0.127 70 12/1/2024
3.0.126 110 12/1/2024
3.0.125 73 12/1/2024
3.0.124 164 12/1/2024
3.0.123 84 12/1/2024
3.0.122 75 12/1/2024
3.0.121 73 12/1/2024
3.0.120 163 11/29/2024
3.0.119 100 11/29/2024
3.0.118 73 11/29/2024
3.0.117 113 11/29/2024
3.0.116 69 11/29/2024
3.0.115 106 11/29/2024
3.0.114 89 11/29/2024
3.0.113 154 11/21/2024
3.0.112 93 11/21/2024
3.0.111 73 11/21/2024
3.0.110 77 11/21/2024
3.0.109 103 11/21/2024
3.0.108 82 11/21/2024
3.0.107 177 11/20/2024
3.0.106 87 11/20/2024
3.0.105 77 11/20/2024
3.0.104 96 11/20/2024
3.0.103 76 11/20/2024
3.0.102 71 11/20/2024
3.0.101 78 11/20/2024
3.0.100 79 11/19/2024
3.0.99 75 11/19/2024
3.0.98 71 11/19/2024
3.0.97 338 11/19/2024
3.0.96 202 11/19/2024
3.0.95 66 11/19/2024
3.0.94 66 11/19/2024
3.0.93 140 11/19/2024
3.0.92 68 11/19/2024
3.0.91 96 11/19/2024
3.0.90 74 11/19/2024
3.0.89 224 11/15/2024
3.0.88 100 11/15/2024
3.0.87 69 11/15/2024
3.0.86 76 11/14/2024
3.0.85 69 11/14/2024
3.0.84 114 11/14/2024
3.0.83 70 11/14/2024
3.0.82 77 11/14/2024
3.0.81 72 11/14/2024
3.0.80 123 11/14/2024
3.0.79 119 11/14/2024
3.0.78 81 11/14/2024
3.0.77 72 11/14/2024
3.0.76 164 11/14/2024
3.0.75 79 11/14/2024
3.0.74 118 11/14/2024
3.0.73 159 11/14/2024
3.0.72 80 11/14/2024
3.0.71 138 11/14/2024
3.0.70 77 11/14/2024
3.0.69 99 11/14/2024
3.0.68 86 11/14/2024
3.0.67 170 11/14/2024
3.0.66 78 11/14/2024
3.0.65 79 11/14/2024
2.1.64 260 11/13/2024
2.1.63 94 11/13/2024
2.1.62 103 11/13/2024
2.1.61 74 11/13/2024
2.1.60 69 11/13/2024
2.1.59 213 11/13/2024
2.1.58 78 11/13/2024
2.1.57 78 11/13/2024
2.1.56 116 11/12/2024
2.1.55 74 11/12/2024
2.1.54 593 11/9/2024
2.1.53 110 11/9/2024
2.1.52 81 11/9/2024
2.1.51 125 11/9/2024
2.1.50 83 11/9/2024
2.1.49 81 11/9/2024
2.1.48 82 11/9/2024
2.1.47 213 11/9/2024
2.1.46 198 11/8/2024
2.1.45 86 11/8/2024
2.1.44 90 11/8/2024
2.1.43 108 11/8/2024
2.1.42 87 11/8/2024
2.1.41 200 11/8/2024
2.1.40 85 11/8/2024
2.1.39 86 11/8/2024
2.1.38 175 11/8/2024
2.1.37 79 11/8/2024
2.1.36 238 11/6/2024
2.1.35 126 11/6/2024
2.1.34 264 11/1/2024
2.1.33 113 11/1/2024
2.1.32 83 11/1/2024
2.1.31 112 11/1/2024
2.1.30 142 11/1/2024
2.1.29 141 11/1/2024
2.1.28 89 11/1/2024
2.1.26 207 10/29/2024
2.1.25 76 10/29/2024
2.1.24 76 10/29/2024
2.1.23 86 10/29/2024
2.1.22 81 10/29/2024
2.1.21 75 10/29/2024
2.1.20 213 10/29/2024
2.1.19 183 10/29/2024
2.1.18 116 10/29/2024
2.1.17 81 10/29/2024
2.1.16 72 10/29/2024
2.1.15 198 10/28/2024
2.1.14 80 10/28/2024
2.1.13 76 10/28/2024
2.1.12 303 10/26/2024
2.1.11 80 10/26/2024
2.1.10 80 10/26/2024
2.1.9 73 10/26/2024
2.1.8 82 10/26/2024
2.1.7 78 10/26/2024
2.1.6 204 10/22/2024
2.1.5 79 10/22/2024
2.1.4 77 10/22/2024
2.1.3 80 10/22/2024
2.1.2 84 10/22/2024
2.1.1 83 10/22/2024