Soenneker.Deduplication.SlidingWindow.Registry 11.0.211

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Deduplication.SlidingWindow.Registry --version 11.0.211
                    
NuGet\Install-Package Soenneker.Deduplication.SlidingWindow.Registry -Version 11.0.211
                    
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.211" />
                    
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.211" />
                    
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.211
                    
#r "nuget: Soenneker.Deduplication.SlidingWindow.Registry, 11.0.211"
                    
#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.211
                    
#: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.211
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.SlidingWindow.Registry&version=11.0.211
                    
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.224 88 11/19/2026
11.0.222 90 11/18/2026
11.0.221 91 11/18/2026
11.0.219 92 11/18/2026
11.0.218 94 11/18/2026
11.0.217 97 11/15/2026
11.0.216 94 11/15/2026
11.0.215 110 11/11/2026
11.0.214 96 11/11/2026
11.0.213 93 11/11/2026
11.0.212 90 11/11/2026
11.0.211 98 11/11/2026
11.0.210 97 11/11/2026
11.0.208 130 11/3/2026
11.0.207 95 11/3/2026
11.0.206 103 11/3/2026
11.0.205 94 11/3/2026
11.0.204 124 10/27/2026
11.0.203 105 10/27/2026
11.0.202 100 10/27/2026
Loading failed

Updated Multiple NuGet packages