Soenneker.Deduplication.SlidingWindow.Registry 11.0.239

Prefix Reserved
dotnet add package Soenneker.Deduplication.SlidingWindow.Registry --version 11.0.239
                    
NuGet\Install-Package Soenneker.Deduplication.SlidingWindow.Registry -Version 11.0.239
                    
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.239" />
                    
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.239" />
                    
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.239
                    
#r "nuget: Soenneker.Deduplication.SlidingWindow.Registry, 11.0.239"
                    
#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.239
                    
#: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.239
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.SlidingWindow.Registry&version=11.0.239
                    
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.239 0 12/2/2026
11.0.237 0 12/2/2026
11.0.236 44 12/2/2026
11.0.235 46 12/2/2026
11.0.234 43 12/2/2026
11.0.233 51 12/1/2026
11.0.232 48 12/1/2026
11.0.231 52 12/1/2026
11.0.230 46 12/1/2026
11.0.229 55 12/1/2026
11.0.228 57 12/1/2026
11.0.227 70 11/30/2026
11.0.226 93 11/29/2026
11.0.225 97 11/29/2026
11.0.224 98 11/19/2026
11.0.222 98 11/18/2026
11.0.221 99 11/18/2026
11.0.219 95 11/18/2026
11.0.218 102 11/18/2026
11.0.217 100 11/15/2026
Loading failed

Updated Multiple NuGet packages