Soenneker.Deduplication.SlidingWindow.Registry 11.0.204

Prefix Reserved
dotnet add package Soenneker.Deduplication.SlidingWindow.Registry --version 11.0.204
                    
NuGet\Install-Package Soenneker.Deduplication.SlidingWindow.Registry -Version 11.0.204
                    
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.Deduplication.SlidingWindow.Registry" Version="11.0.204" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Deduplication.SlidingWindow.Registry" Version="11.0.204" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Deduplication.SlidingWindow.Registry" />
                    
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.Deduplication.SlidingWindow.Registry --version 11.0.204
                    
#r "nuget: Soenneker.Deduplication.SlidingWindow.Registry, 11.0.204"
                    
#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.Deduplication.SlidingWindow.Registry@11.0.204
                    
#: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.Deduplication.SlidingWindow.Registry&version=11.0.204
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.SlidingWindow.Registry&version=11.0.204
                    
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

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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
11.0.204 52 10/27/2026
11.0.203 53 10/27/2026
11.0.202 51 10/27/2026
11.0.201 74 10/26/2026
11.0.200 82 10/26/2026
11.0.198 79 10/26/2026
11.0.197 81 10/26/2026
11.0.196 85 10/26/2026
11.0.195 88 10/26/2026
4.0.194 283 10/15/2026
4.0.193 107 10/15/2026
4.0.192 91 10/15/2026
4.0.191 94 10/14/2026
4.0.190 90 10/14/2026
4.0.188 93 10/14/2026
4.0.187 86 10/14/2026
4.0.186 88 10/14/2026
4.0.179 87 10/13/2026
4.0.178 90 10/12/2026
4.0.176 91 10/12/2026
Loading failed

Updated Soenneker.Deduplication.SlidingWindow to 11.0.149