Soenneker.Deduplication.Bounded.Registry 4.0.162

Prefix Reserved
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
4.0.162 0 9/25/2026
4.0.161 0 9/25/2026
4.0.160 0 9/25/2026
4.0.159 0 9/25/2026
4.0.158 52 9/24/2026
4.0.157 96 9/17/2026
4.0.156 97 9/16/2026
4.0.154 92 9/16/2026
4.0.153 82 9/16/2026
4.0.152 93 9/15/2026
4.0.151 92 9/13/2026
4.0.150 90 9/13/2026
4.0.149 99 9/13/2026
4.0.148 93 9/13/2026
4.0.147 91 9/13/2026
4.0.146 104 9/12/2026
4.0.145 87 9/12/2026
4.0.144 90 9/12/2026
4.0.143 96 9/9/2026
4.0.142 94 9/9/2026
Loading failed

Updated Soenneker.Dictionaries.Singletons to 4.0.110