Version: v1.2.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2021 License: MIT Imports: 4 Imported by: 1




This section is empty.


View Source
var ErrTooLargeOffset = errors.New("too large offset")

ErrTooLargeOffset indicates the offset is too large in bitset.


This section is empty.


type Filter added in v1.1.5

type Filter struct {
	// contains filtered or unexported fields

A Filter is a bloom filter.

func New

func New(store *redis.Redis, key string, bits uint) *Filter

New create a Filter, store is the backed redis, key is the key for the bloom filter, bits is how many bits will be used, maps is how many hashes for each addition. best practices: elements - means how many actual elements when maps = 14, formula: 0.7*(bits/maps), bits = 20*elements, the error rate is 0.000067 < 1e-4 for detailed error rate table, see

func (*Filter) Add added in v1.1.5

func (f *Filter) Add(data []byte) error

Add adds data into f.

func (*Filter) Exists added in v1.1.5

func (f *Filter) Exists(data []byte) (bool, error)

Exists checks if data is in f.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL