You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/example/bloom/bloom.go

19 lines
428 B
Go

4 years ago
package main
import (
"fmt"
"github.com/tal-tech/go-zero/core/bloom"
"github.com/tal-tech/go-zero/core/stores/redis"
4 years ago
)
func main() {
store := redis.NewRedis("localhost:6379", "node")
filter := bloom.New(store, "testbloom", 64)
filter.Add([]byte("kevin"))
filter.Add([]byte("wan"))
fmt.Println(filter.Exists([]byte("kevin")))
fmt.Println(filter.Exists([]byte("wan")))
fmt.Println(filter.Exists([]byte("nothing")))
}