Soenneker.Deduplication.Bounded.Registry 4.0.162

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Deduplication.Bounded.Registry --version 4.0.162
                    
NuGet\Install-Package Soenneker.Deduplication.Bounded.Registry -Version 4.0.162
                    
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.162" />
                    
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.162" />
                    
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.162
                    
#r "nuget: Soenneker.Deduplication.Bounded.Registry, 4.0.162"
                    
#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.162
                    
#: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.162
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.Bounded.Registry&version=4.0.162
                    
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
11.0.195 0 10/27/2026
11.0.194 0 10/27/2026
11.0.193 47 10/26/2026
11.0.192 45 10/26/2026
11.0.190 55 10/26/2026
11.0.189 44 10/26/2026
11.0.188 40 10/26/2026
11.0.187 51 10/26/2026
11.0.186 51 10/26/2026
4.0.185 96 10/15/2026
4.0.184 85 10/15/2026
4.0.183 86 10/15/2026
4.0.182 92 10/14/2026
4.0.181 80 10/14/2026
4.0.180 84 10/14/2026
4.0.178 87 10/14/2026
4.0.177 83 10/14/2026
4.0.172 86 10/13/2026
4.0.171 89 10/12/2026
4.0.162 109 9/25/2026
Loading failed

Updated Soenneker.Dictionaries.Singletons to 4.0.110