Soenneker.Deduplication.SlidingWindow.Registry
4.0.126
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Deduplication.SlidingWindow.Registry --version 4.0.126
NuGet\Install-Package Soenneker.Deduplication.SlidingWindow.Registry -Version 4.0.126
<PackageReference Include="Soenneker.Deduplication.SlidingWindow.Registry" Version="4.0.126" />
<PackageVersion Include="Soenneker.Deduplication.SlidingWindow.Registry" Version="4.0.126" />
<PackageReference Include="Soenneker.Deduplication.SlidingWindow.Registry" />
paket add Soenneker.Deduplication.SlidingWindow.Registry --version 4.0.126
#r "nuget: Soenneker.Deduplication.SlidingWindow.Registry, 4.0.126"
#:package Soenneker.Deduplication.SlidingWindow.Registry@4.0.126
#addin nuget:?package=Soenneker.Deduplication.SlidingWindow.Registry&version=4.0.126
#tool nuget:?package=Soenneker.Deduplication.SlidingWindow.Registry&version=4.0.126
Soenneker.Deduplication.SlidingWindow.Registry
A thread-safe registry that creates and reuses one in-memory sliding-window deduplicator per string key.
Installation
dotnet add package Soenneker.Deduplication.SlidingWindow.Registry
Registration
using Soenneker.Deduplication.SlidingWindow.Registry.Registrars;
services.AddSlidingWindowDedupeRegistryAsSingleton();
Singleton registration shares each key’s recent-history window across dependency-injection scopes. Use AddSlidingWindowDedupeRegistryAsScoped() only when each scope should have independent history.
Usage
using Soenneker.Deduplication.SlidingWindow.Abstract;
using Soenneker.Deduplication.SlidingWindow.Registry.Abstract;
public sealed class EventConsumer(ISlidingWindowDedupeRegistry registry)
{
public async ValueTask<bool> ShouldProcess(string tenantId, string eventId, CancellationToken cancellationToken)
{
ISlidingWindowDedupe dedupe = await registry.Get(
key: $"tenant:{tenantId}",
window: TimeSpan.FromMinutes(10),
rotationInterval: TimeSpan.FromSeconds(10),
cancellationToken);
return dedupe.TryMarkSeen(eventId);
}
}
The first successful lookup creates the instance. Later calls for the same key return it even when they supply a different window or rotation interval, so keep those settings consistent.
Releasing inactive keys
Each registry key owns a set and a background rotation timer. The number of registry keys is not bounded; do not derive keys from uncontrolled high-cardinality input.
await registry.Remove($"tenant:{tenantId}", cancellationToken);
// Dispose every cached set and clear all history:
await registry.Clear(cancellationToken);
Removal disposes the cached instance. Do not continue using an instance after its key is removed. A later Get creates a fresh window with the newly supplied configuration. TryGet checks the cache without creating anything.
Dispose the registry itself at the end of its lifetime so all remaining rotation tasks are stopped.
| 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.Deduplication.SlidingWindow (>= 4.0.91)
- Soenneker.Dictionaries.Singletons (>= 4.0.87)
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.148 | 37 | 9/9/2026 |
| 4.0.147 | 37 | 9/9/2026 |
| 4.0.146 | 50 | 9/8/2026 |
| 4.0.145 | 51 | 9/8/2026 |
| 4.0.144 | 49 | 9/8/2026 |
| 4.0.142 | 68 | 9/7/2026 |
| 4.0.141 | 81 | 9/7/2026 |
| 4.0.140 | 75 | 9/7/2026 |
| 4.0.139 | 83 | 9/7/2026 |
| 4.0.138 | 87 | 9/5/2026 |
| 4.0.137 | 85 | 9/5/2026 |
| 4.0.136 | 88 | 9/4/2026 |
| 4.0.135 | 88 | 9/4/2026 |
| 4.0.134 | 85 | 9/4/2026 |
| 4.0.133 | 91 | 9/4/2026 |
| 4.0.132 | 91 | 9/4/2026 |
| 4.0.131 | 91 | 9/1/2026 |
| 4.0.130 | 94 | 8/31/2026 |
| 4.0.129 | 91 | 8/31/2026 |
| 4.0.126 | 92 | 8/30/2026 |
Update dependency Soenneker.Dictionaries.Singletons to 4.0.87 (#279)