Bloom Filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970.
This implement is experimental to written Golang to prove the basic concept of Bloom Filter.
go get github.com/kkdai/bloomfilter
//Create a couting bloom filter expect size 100, false detect rate 0.01
cbf := NewCountingBloomFilter(100, 0.01)
//Add item into cbf
cbf.Add([]byte("foo"))
cbf.Add([]byte("john"))
cbf.Add([]byte("tom"))
//test
fmt.Println("Test cbf:", cbf.Test([]byte("tom"))) //return "true"
//Remvoe item from cbf
cbf.Remove([]byte("john"))
//test again
fmt.Println("Test cbf:", cbf.Test([]byte("john"))) //return "false"
It is one of my project 52.
This package is licensed under MIT license. See LICENSE for details.