Soenneker.Utils.RateLimiting.Factory 4.0.1227

Prefix Reserved
dotnet add package Soenneker.Utils.RateLimiting.Factory --version 4.0.1227
                    
NuGet\Install-Package Soenneker.Utils.RateLimiting.Factory -Version 4.0.1227
                    
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="4.0.1227" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.RateLimiting.Factory" Version="4.0.1227" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.RateLimiting.Factory" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Utils.RateLimiting.Factory --version 4.0.1227
                    
#r "nuget: Soenneker.Utils.RateLimiting.Factory, 4.0.1227"
                    
#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.
#:package Soenneker.Utils.RateLimiting.Factory@4.0.1227
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=4.0.1227
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=4.0.1227
                    
Install as a Cake Tool

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

alternate text is missing from this package README image Soenneker.Utils.RateLimiting.Factory

Provides one shared RateLimitingExecutor per string ID.

Installation

dotnet add package Soenneker.Utils.RateLimiting.Factory

Registration

using Soenneker.Utils.RateLimiting.Factory.Registrars;

services.AddRateLimitingFactoryAsSingleton();

Singleton registration is the normal choice when an ID represents an application-wide upstream limit. Scoped registration creates a separate dictionary and separate executors in every scope, so requests in different scopes do not throttle one another.

Get and use a keyed executor

RateLimitingExecutor executor = await factory.Get(
    id: "vendor-api",
    interval: TimeSpan.FromSeconds(2),
    cancellationToken);

ApiResponse response = await executor.Execute(
    token => apiClient.Send(token),
    cancellationToken);

The ID is the cache key. Concurrent calls for the same ID receive the same executor; different IDs have independent locks and schedules. The interval supplied when an ID is first created wins. Later calls for that ID return the existing executor and do not reconfigure it, so use stable IDs and pass a consistent interval.

The factory owns cached executors. Callers should use them but must not dispose or permanently cancel them. The cancellation token passed to Get applies while obtaining the cached value; pass the operation token again to Execute for waiting and delegate cancellation. GetSync provides the same cache semantics for synchronous acquisition.

Remove an executor

bool removed = await factory.Remove("vendor-api");

Removal coordinates with in-flight creation, removes the keyed executor, and disposes it. Any caller still holding that instance now has a canceled/disposed executor, so remove only after its users have been coordinated. A later Get for the same ID creates a new executor and establishes a new interval. Remove returns false when no value was present; RemoveSync is the synchronous equivalent without a result.

Disposing the factory removes and disposes all cached executors. Let dependency injection own that lifetime. Because IDs remain cached until removal or factory disposal, avoid unbounded IDs derived from individual requests or users.

For execution spacing, delegate forms, and terminal cancellation behavior, see Soenneker.Utils.RateLimiting.Executor.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
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
4.0.1227 212 10/15/2026
4.0.1226 99 10/14/2026
4.0.1225 100 10/14/2026
4.0.1224 86 10/14/2026
4.0.1223 96 10/14/2026
4.0.1222 103 10/14/2026
4.0.1220 86 10/14/2026
4.0.1219 78 10/14/2026
4.0.1213 118 10/13/2026
4.0.1212 100 10/13/2026
4.0.1211 92 10/13/2026
4.0.1208 167 10/12/2026
4.0.1207 83 10/12/2026
4.0.1206 192 10/11/2026
4.0.1205 137 10/11/2026
4.0.1204 392 9/30/2026
4.0.1203 252 9/29/2026
4.0.1202 146 9/29/2026
4.0.1201 96 9/29/2026
4.0.1200 119 9/29/2026
Loading failed

Updated NuGet packages