BloomFilterIdempotencyChecker

class BloomFilterIdempotencyChecker(ttl: Duration, bloomFilterSupplier: () -> BloomFilter<String>) : IdempotencyChecker

Idempotency checker implementation using Bloom filters for efficient duplicate detection. Bloom filters provide probabilistic duplicate detection with configurable false positive rates, making them suitable for high-throughput scenarios where perfect accuracy is not required.

The checker automatically refreshes the Bloom filter based on the configured TTL, ensuring that old entries are periodically cleared to prevent memory leaks.

Note: Bloom filters can produce false positives (reporting an element as duplicate when it's not), but never false negatives (missing actual duplicates).

Author

ahoo wang

Parameters

ttl

the time-to-live duration for the Bloom filter before it gets refreshed

bloomFilterSupplier

supplier function that creates new Bloom filter instances

See also

Constructors

Link copied to clipboard
constructor(ttl: Duration, bloomFilterSupplier: () -> BloomFilter<String>)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun check(element: String): Mono<Boolean>

Checks if the element is a potential duplicate using the Bloom filter. If the element might be contained (possible duplicate), returns false. If the element is definitely not contained (unique), adds it to the filter and returns true.