Skip to content

splashing-atom/go-bloomfilter

 
 

Repository files navigation

go-bloomfilter

A simple and high-performance Bloom filter written in golang.

Support memory storage and redis.

Examples

MemoryBloomFilter

import bloomfilter "github.com/alovn/go-bloomfilter"

bloom := bloomfilter.NewMemoryBloomFilter(10000)
_ = bloom.Put([]byte("bloom"))
exists,err := bloom.MightContain(bs)

RedisBloomFilter

import bloomfilter "github.com/alovn/go-bloomfilter"

cli := redis.NewClient(&redis.Options{
    Addr:     "127.0.0.1:6379",
    Password: "",
    DB:       0,
})

key := "redis bloomfilter"

bloom := bloomfilter.NewRedisBloomFilter(cli, "test", 10000)

bs := []byte(key)
_ = bloom.Put(bs)
exists, err := bloom.MightContain(bs)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%