Documentation
¶
Overview ¶
Package bloom implements process-local probabilistic membership filters. Callers must account for false positives and provide external persistence or coordination when filters are shared across application instances.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountMinSketch ¶
type CountMinSketch struct {
// contains filtered or unexported fields
}
CountMinSketch implements frequency estimation for top-K trending items.
func NewCountMinSketch ¶
func NewCountMinSketch() *CountMinSketch
NewCountMinSketch creates a Count-Min Sketch frequency estimator.
func (*CountMinSketch) Add ¶
func (cms *CountMinSketch) Add(item string, count uint64)
Add increments the frequency count for an item.
func (*CountMinSketch) EstimateFrequency ¶
func (cms *CountMinSketch) EstimateFrequency(item string) uint64
EstimateFrequency estimates the total frequency count of an item.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter implements a high-performance Bloom Filter for preventing cache penetration attacks.
func NewFilter ¶
NewFilter creates a new Bloom Filter tuned for expected capacity and false positive rate.
func (*Filter) MayContain ¶
MayContain tests if key is possibly in the set. If it returns false, the key 100% does NOT exist!
type HyperLogLog ¶
type HyperLogLog struct {
// contains filtered or unexported fields
}
HyperLogLog implements probabilistic cardinality counting for unique visitors in constant memory.
func NewHyperLogLog ¶
func NewHyperLogLog() *HyperLogLog
NewHyperLogLog creates a HyperLogLog cardinality counter.
func (*HyperLogLog) Add ¶
func (hll *HyperLogLog) Add(element string)
Add adds an element to the HyperLogLog set.
func (*HyperLogLog) EstimateCardinality ¶
func (hll *HyperLogLog) EstimateCardinality() uint64
EstimateCardinality returns the estimated count of unique elements.