TOC

Golang 布隆过滤器

https://github.com/bits-and-blooms/bloom/v3

package main

import (
    "fmt"
    "github.com/bits-and-blooms/bloom/v3"
)

func main() {
    filter := bloom.New(1000000, 5)
    filter.Add([]byte("apple"))
    filter.Add([]byte("banana"))
    filter.Add([]byte("orange"))
    fmt.Println(filter.Test([]byte("apple")))
    fmt.Println(filter.Test([]byte("banana")))
    fmt.Println(filter.Test([]byte("orange")))
    fmt.Println(filter.Test([]byte("grape")))
    fmt.Println(filter.Test([]byte("watermelon")))
}