![]() |
VOOZH | about |
dotnet add package Soenneker.Deduplication.Bounded --version 4.0.46
NuGet\Install-Package Soenneker.Deduplication.Bounded -Version 4.0.46
<PackageReference Include="Soenneker.Deduplication.Bounded" Version="4.0.46" />
<PackageVersion Include="Soenneker.Deduplication.Bounded" Version="4.0.46" />Directory.Packages.props
<PackageReference Include="Soenneker.Deduplication.Bounded" />Project file
paket add Soenneker.Deduplication.Bounded --version 4.0.46
#r "nuget: Soenneker.Deduplication.Bounded, 4.0.46"
#:package Soenneker.Deduplication.Bounded@4.0.46
#addin nuget:?package=Soenneker.Deduplication.Bounded&version=4.0.46Install as a Cake Addin
#tool nuget:?package=Soenneker.Deduplication.Bounded&version=4.0.46Install 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
dotnet add package Soenneker.Deduplication.Bounded
Soenneker.Deduplication.Bounded provides a fast, thread-safe “seen set” for deduplication with a maximum size.
You call TryMarkSeen(...) with an input value:
true if this value has not been seen before (it was added)false if it has already been seen (already exists)Internally it hashes your input to a ulong using XXH3 (XxHash3) and stores only the hash in a bounded concurrent set. That means it’s very memory efficient and avoids storing original strings/byte arrays.
MaxSize and opportunistically trims under contention (best-effort, not strict)ulong hashes instead of stringsReadOnlySpan<char> and ReadOnlySpan<byte>Countusing Soenneker.Deduplication.Bounded;
var dedupe = new BoundedDedupe(maxSize: 250_000);
// returns true the first time
if (dedupe.TryMarkSeen("user:123"))
{
// process first occurrence
}
// returns false on repeats
if (!dedupe.TryMarkSeen("user:123"))
{
// duplicate
}
Use these for the fast “check + add” operation.
bool added = dedupe.TryMarkSeen("some string");
bool added2 = dedupe.TryMarkSeen("some string".AsSpan());
bool added3 = dedupe.TryMarkSeenUtf8(utf8Bytes);
Pure membership checks (no mutation).
bool exists = dedupe.Contains("some string");
bool exists2 = dedupe.Contains("some string".AsSpan());
bool exists3 = dedupe.ContainsUtf8(utf8Bytes);
Removes an entry if present.
bool removed = dedupe.TryRemove("some string");
bool removed2 = dedupe.TryRemove("some string".AsSpan());
bool removed3 = dedupe.TryRemoveUtf8(utf8Bytes);
int max = dedupe.MaxSize;
int approx = dedupe.Count; // approximate; good for diagnostics/telemetry
var dedupe = new BoundedDedupe(
maxSize: 250_000,
capacityHint: 300_000, // optional, reduces resizing
seed: 0, // optional XXH3 seed
trimBatchSize: 64, // work chunk size when trimming
trimStartOveragePercent: 5, // begin trimming after +5% over MaxSize
maxTrimWorkPerCall: 4096, // caps trimming effort per write
resyncAfterNoProgress: 8, // resync count if trimming stalls
queueOverageFactor: 4 // internal queue sizing multiplier
);
This is not a strict LRU and does not guarantee exact eviction order. Under heavy contention it may temporarily exceed MaxSize, then trims opportunistically during subsequent writes.
This design is intentional: it favors throughput and low contention over perfect eviction accuracy.
Inputs are deduped by their 64-bit XXH3 hash (ulong). Like all hashing-based dedupe approaches, there is a theoretical possibility of collisions (different inputs producing the same hash). For most dedupe/telemetry/rate-limit style workloads, a 64-bit hash is typically more than sufficient.
If collision risk is unacceptable for your use case, you should store full keys (or use a stronger scheme), at higher memory cost.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Soenneker.Deduplication.Bounded:
| Package | Downloads |
|---|---|
|
Soenneker.Deduplication.Bounded.Registry
A keyed registry of bounded dedupe instances. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.46 | 0 | 6/19/2026 |
| 4.0.45 | 0 | 6/19/2026 |
| 4.0.44 | 63 | 6/16/2026 |
| 4.0.43 | 123 | 6/10/2026 |
| 4.0.42 | 121 | 6/10/2026 |
| 4.0.41 | 156 | 6/6/2026 |
| 4.0.40 | 136 | 6/6/2026 |
| 4.0.39 | 130 | 6/6/2026 |
| 4.0.38 | 124 | 6/5/2026 |
| 4.0.37 | 196 | 5/13/2026 |
| 4.0.36 | 154 | 5/3/2026 |
| 4.0.35 | 166 | 4/24/2026 |
| 4.0.34 | 127 | 4/23/2026 |
| 4.0.33 | 120 | 4/23/2026 |
| 4.0.32 | 129 | 4/23/2026 |
| 4.0.31 | 121 | 4/22/2026 |
| 4.0.30 | 105 | 4/22/2026 |
| 4.0.29 | 145 | 4/21/2026 |
| 4.0.28 | 143 | 4/14/2026 |
| 4.0.27 | 174 | 3/31/2026 |