# README
Bloom Filter
simple bloom filter based on redis.
Usage
go get -u github.com/go-cinch/common/bloom
import (
"fmt"
"github.com/go-cinch/common/bloom"
"github.com/go-redis/redis/v8"
)
func main() {
client := redis.NewClient(&redis.Options{
Addr: "127.0.0.1:6379",
DB: 0,
})
b := bloom.New(
bloom.WithRedis(client),
)
b.Add("abc")
fmt.Println(b.Exist("abc"))
fmt.Println(b.Exist("def"))
b.Add("def")
fmt.Println(b.Exist("abc"))
fmt.Println(b.Exist("def"))
}
Options
WithRedis
- redis client, default 127.0.0.1:6379WithKey
- redis cache key, default bloomWithExpire
- key expire time, default 5 minutesWithHash
- bloom hash function, default BKDRHash + SDBMHash + DJBHashWithTimeout
- exec redis command timeout, default 5 seconds
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author