Soenneker.Utils.RateLimiting.Factory
4.0.1157
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.RateLimiting.Factory --version 4.0.1157
NuGet\Install-Package Soenneker.Utils.RateLimiting.Factory -Version 4.0.1157
<PackageReference Include="Soenneker.Utils.RateLimiting.Factory" Version="4.0.1157" />
<PackageVersion Include="Soenneker.Utils.RateLimiting.Factory" Version="4.0.1157" />
<PackageReference Include="Soenneker.Utils.RateLimiting.Factory" />
paket add Soenneker.Utils.RateLimiting.Factory --version 4.0.1157
#r "nuget: Soenneker.Utils.RateLimiting.Factory, 4.0.1157"
#:package Soenneker.Utils.RateLimiting.Factory@4.0.1157
#addin nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=4.0.1157
#tool nuget:?package=Soenneker.Utils.RateLimiting.Factory&version=4.0.1157
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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Soenneker.Dictionaries.Singletons (>= 4.0.87)
- Soenneker.Utils.RateLimiting.Executor (>= 4.0.571)
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.1159 | 0 | 8/31/2026 |
| 4.0.1158 | 0 | 8/31/2026 |
| 4.0.1157 | 0 | 8/31/2026 |
| 4.0.1156 | 0 | 8/30/2026 |
| 4.0.1155 | 19 | 8/30/2026 |
| 4.0.1154 | 37 | 8/30/2026 |
| 4.0.1153 | 39 | 8/30/2026 |
| 4.0.1152 | 61 | 8/30/2026 |
| 4.0.1151 | 41 | 8/30/2026 |
| 4.0.1150 | 74 | 8/30/2026 |
| 4.0.1149 | 36 | 8/29/2026 |
| 4.0.1148 | 48 | 8/29/2026 |
| 4.0.1147 | 76 | 8/29/2026 |
| 4.0.1146 | 147 | 8/26/2026 |
| 4.0.1145 | 87 | 8/26/2026 |
| 4.0.1144 | 281 | 8/21/2026 |
| 4.0.1143 | 276 | 8/18/2026 |
| 4.0.1142 | 359 | 8/13/2026 |
| 4.0.1141 | 101 | 8/12/2026 |
| 4.0.1140 | 164 | 8/12/2026 |
Update dependency Soenneker.Utils.RateLimiting.Executor to 4.0.571 (#1876)