Soenneker.Deduplication.Bounded.Registry 4.0.185

Prefix Reserved
dotnet add package Soenneker.Deduplication.Bounded.Registry --version 4.0.185
                    
NuGet\Install-Package Soenneker.Deduplication.Bounded.Registry -Version 4.0.185
                    
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.Bounded.Registry" Version="4.0.185" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Deduplication.Bounded.Registry" Version="4.0.185" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Deduplication.Bounded.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.Bounded.Registry --version 4.0.185
                    
#r "nuget: Soenneker.Deduplication.Bounded.Registry, 4.0.185"
                    
#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.Bounded.Registry@4.0.185
                    
#: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.Bounded.Registry&version=4.0.185
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.Bounded.Registry&version=4.0.185
                    
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.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 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. 
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
4.0.185 31 10/15/2026
4.0.184 33 10/15/2026
4.0.183 49 10/15/2026
4.0.182 55 10/14/2026
4.0.181 45 10/14/2026
4.0.180 46 10/14/2026
4.0.178 51 10/14/2026
4.0.177 46 10/14/2026
4.0.172 52 10/13/2026
4.0.171 62 10/12/2026
4.0.169 65 10/12/2026
4.0.168 68 10/12/2026
4.0.167 64 10/11/2026
4.0.166 69 10/11/2026
4.0.165 121 9/30/2026
4.0.164 90 9/29/2026
4.0.163 104 9/29/2026
4.0.162 104 9/25/2026
4.0.161 94 9/25/2026
4.0.160 102 9/25/2026
Loading failed

Update dependency Soenneker.Deduplication.Bounded to 4.0.118 (#339)