NewDistinctString with the given maximum data size and max items. MaxDataSize is calculated as the total length of the recorded strings. For ease of use, maxDataSize=0 and maxItems=0 are interpreted as unlimited.
(maxDataSize int, maxValues uint32, staleValueThreshold uint32)
| 26 | // MaxDataSize is calculated as the total length of the recorded strings. |
| 27 | // For ease of use, maxDataSize=0 and maxItems=0 are interpreted as unlimited. |
| 28 | func NewDistinctString(maxDataSize int, maxValues uint32, staleValueThreshold uint32) *DistinctString { |
| 29 | return &DistinctString{ |
| 30 | values: make(map[string]struct{}), |
| 31 | maxDataSize: maxDataSize, |
| 32 | diffEnabled: false, // disable diff to make it faster |
| 33 | maxValues: maxValues, |
| 34 | maxCacheHits: staleValueThreshold, |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // NewDistinctStringWithDiff is like NewDistinctString but with diff support enabled. |
| 39 | // MaxDataSize is calculated as the total length of the recorded strings. |
no outgoing calls