Soenneker.Deduplication.Bounded.Registry
4.0.162
Prefix Reserved
dotnet add package Soenneker.Deduplication.Bounded.Registry --version 4.0.162
NuGet\Install-Package Soenneker.Deduplication.Bounded.Registry -Version 4.0.162
<PackageReference Include="Soenneker.Deduplication.Bounded.Registry" Version="4.0.162" />
<PackageVersion Include="Soenneker.Deduplication.Bounded.Registry" Version="4.0.162" />
<PackageReference Include="Soenneker.Deduplication.Bounded.Registry" />
paket add Soenneker.Deduplication.Bounded.Registry --version 4.0.162
#r "nuget: Soenneker.Deduplication.Bounded.Registry, 4.0.162"
#:package Soenneker.Deduplication.Bounded.Registry@4.0.162
#addin nuget:?package=Soenneker.Deduplication.Bounded.Registry&version=4.0.162
#tool nuget:?package=Soenneker.Deduplication.Bounded.Registry&version=4.0.162
Soenneker.Deduplication.Bounded.Registry
A thread-safe registry that creates and reuses one bounded in-memory deduplicator per string key.
Installation
dotnet add package Soenneker.Deduplication.Bounded.Registry
Registration
using Soenneker.Deduplication.Bounded.Registry.Registrars;
services.AddBoundedDedupeRegistryAsSingleton();
Use the singleton registration when keys should share dedupe history across requests. The scoped registration creates a separate registry and separate history for each dependency-injection scope:
services.AddBoundedDedupeRegistryAsScoped();
Usage
using Soenneker.Deduplication.Bounded.Abstract;
using Soenneker.Deduplication.Bounded.Registry.Abstract;
public sealed class EventConsumer(IBoundedDedupeRegistry registry)
{
public async ValueTask<bool> ShouldProcess(string tenantId, string eventId, CancellationToken cancellationToken)
{
IBoundedDedupe dedupe = await registry.Get(
key: $"tenant:{tenantId}",
maxSize: 100_000,
cancellationToken);
return dedupe.TryMarkSeen(eventId);
}
}
The first successful Get or GetSync for a key creates its instance. Later calls with the same key return that instance, even when they supply a different maxSize; choose the size consistently at the call site.
Managing registry keys
Each distinct registry key owns another bounded set. The sets are bounded, but the number of registry keys is not, so do not use arbitrary user input as a key without controlling its cardinality.
Remove keys that are no longer active:
await registry.Remove($"tenant:{tenantId}", cancellationToken);
// Or discard all cached histories:
await registry.Clear(cancellationToken);
After removal, a later Get creates an empty deduplicator with the newly supplied size. TryGet performs a lookup without creating anything.
Disposing the registry releases its underlying cache. Do not use a registry or a deduplicator obtained from it after the registry has been disposed.
| 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
- Soenneker.Deduplication.Bounded (>= 4.0.97)
- Soenneker.Dictionaries.Singletons (>= 4.0.110)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.162 | 0 | 9/25/2026 |
| 4.0.161 | 0 | 9/25/2026 |
| 4.0.160 | 0 | 9/25/2026 |
| 4.0.159 | 0 | 9/25/2026 |
| 4.0.158 | 52 | 9/24/2026 |
| 4.0.157 | 96 | 9/17/2026 |
| 4.0.156 | 97 | 9/16/2026 |
| 4.0.154 | 92 | 9/16/2026 |
| 4.0.153 | 82 | 9/16/2026 |
| 4.0.152 | 93 | 9/15/2026 |
| 4.0.151 | 92 | 9/13/2026 |
| 4.0.150 | 90 | 9/13/2026 |
| 4.0.149 | 99 | 9/13/2026 |
| 4.0.148 | 93 | 9/13/2026 |
| 4.0.147 | 91 | 9/13/2026 |
| 4.0.146 | 104 | 9/12/2026 |
| 4.0.145 | 87 | 9/12/2026 |
| 4.0.144 | 90 | 9/12/2026 |
| 4.0.143 | 96 | 9/9/2026 |
| 4.0.142 | 94 | 9/9/2026 |
Updated Soenneker.Dictionaries.Singletons to 4.0.110