Soenneker.Deduplication.SlidingWindow 11.0.149

Prefix Reserved
dotnet add package Soenneker.Deduplication.SlidingWindow --version 11.0.149
                    
NuGet\Install-Package Soenneker.Deduplication.SlidingWindow -Version 11.0.149
                    
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" Version="11.0.149" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Deduplication.SlidingWindow" Version="11.0.149" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Deduplication.SlidingWindow" />
                    
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 --version 11.0.149
                    
#r "nuget: Soenneker.Deduplication.SlidingWindow, 11.0.149"
                    
#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@11.0.149
                    
#: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&version=11.0.149
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.SlidingWindow&version=11.0.149
                    
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

A thread-safe, in-memory “seen recently” set with bucketed expiration and compact XXH3-64 keys.

Installation

dotnet add package Soenneker.Deduplication.SlidingWindow

Usage

using Soenneker.Deduplication.SlidingWindow;

await using var dedupe = new SlidingWindowXxHashDedupe(
    window: TimeSpan.FromMinutes(5),
    rotationInterval: TimeSpan.FromSeconds(10),
    capacityHint: 100_000);

if (dedupe.TryMarkSeen("event:01J..."))
{
    // First observation inside the active window.
}

TryMarkSeen returns true when the hash was absent and adds it. A repeat returns false and refreshes that hash into the current time bucket, so it remains present until a full window passes without another observation.

Use Contains for a non-refreshing lookup and TryRemove to make a value immediately eligible again:

bool recentlySeen = dedupe.Contains(eventId);
bool removed = dedupe.TryRemove(eventId);

Window precision

Expiration is bucketed rather than per-item. The bucket count is Ceiling(window / rotationInterval), with a minimum of two buckets. A key therefore expires on a rotation near the configured window boundary, not at an exact timestamp.

Choose a shorter rotation interval for finer expiry precision, at the cost of more buckets and more frequent cleanup. capacityHint sizes the internal dictionary initially; it is not a hard memory limit.

Repeated observations are queued so the implementation can preserve the latest bucket safely. Memory use therefore depends on both unique keys and observation rate; it is not simply eight bytes per unique hash.

Hash representation

Original values are not retained. The string and ReadOnlySpan<char> APIs hash UTF-16 characters, while the Utf8 APIs hash the supplied bytes. Use one representation consistently for mark, lookup, and removal.

Different inputs can theoretically share a 64-bit hash. Use exact keys when collision tolerance is unacceptable.

Lifetime and scope

The instance owns a background rotation task and must be disposed. It is process-local: restarts lose history, and separate application instances do not share it. It is useful for best-effort suppression and reducing repeated work, but it is not an exactly-once or durable idempotency boundary.

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 (1)

Showing the top 1 NuGet packages that depend on Soenneker.Deduplication.SlidingWindow:

Package Downloads
Soenneker.Deduplication.SlidingWindow.Registry

A keyed registry of sliding window dedupe instances.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.149 88 10/27/2026
11.0.148 90 10/27/2026
11.0.147 102 10/26/2026
11.0.144 102 10/26/2026
11.0.143 103 10/26/2026
11.0.142 114 10/26/2026
4.0.141 102 10/26/2026
4.0.140 329 10/15/2026
4.0.139 103 10/15/2026
4.0.138 104 10/14/2026
4.0.136 97 10/14/2026
4.0.135 100 10/14/2026
4.0.134 121 10/14/2026
4.0.133 98 10/14/2026
4.0.128 104 10/13/2026
4.0.127 118 10/12/2026
4.0.125 112 10/12/2026
4.0.124 94 10/12/2026
4.0.123 96 10/12/2026
4.0.122 130 10/11/2026
Loading failed

Updated Soenneker.Sets.Concurrent.SlidingWindow to 11.0.107