Documentation ¶
Overview ¶
A simple and high-performance Bloom filter written in golang.
import bloomfilter "github.com/splashing-atom/go-bloomfilter"
MemoryBloomFilter:
bloom := bloomfilter.NewMemoryBloomFilter(10000) bs := []byte("bloom") _ = bloom.Put(bs) exists, err := bloom.MightContain(bs)
RedisBloomFilter:
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)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BloomFilter ¶
BloomFilter interface define
func NewMemoryBloomFilter ¶
func NewMemoryBloomFilter(size uint64) BloomFilter
NewMemoryBloomFilter implementation with memory
type RedisBackedBloomFilter ¶
type RedisBackedBloomFilter interface { BloomFilter PutCtx(context.Context, []byte) error MightContainCtx(context.Context, []byte) (bool, error) BucketCount() uint64 BucketName(index uint64) string }
func NewRedisBloomFilter ¶
func NewRedisBloomFilter(redisCli *redis.Client, redisKey string, size uint64) RedisBackedBloomFilter
Source Files ¶
Click to show internal directories.
Click to hide internal directories.