DedupCache
classA TTL-windowed fingerprint cache for opt-in event deduplication.
Constructor
constructor
Initialize self. See help(type(self)) for accurate signature.
Properties
| Name | Type | Description |
|---|---|---|
size | int | Number of fingerprints currently cached. |
Methods
clear
Drop all cached fingerprints (the suppression count is preserved).
fingerprint
Compute a content fingerprint for an event. Uses `json.dumps(payload, sort_keys=True, default=str)` so structurally equal payloads (regardless of dict key order) share a fingerprint. Non-serializable payloads (e.g. containing cycles) fall back to an `id()` + timestamp fingerprint, so they are effectively **never** deduplicated rather than falsely coalesced.
is_duplicate
Whether this emit should be skipped as a duplicate. Records the event's fingerprint as a side effect (so a later identical event within the window is caught). When neither content dedup nor a `dedup_key` is active, returns `False` immediately without touching the cache.