Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bloomfilter ¶
type Bloomfilter struct { Filter bitvector // our filter bit vector M uint32 // size of bit vector in bits K uint32 // distinct hash functions needed FalsePositiveRate float64 Capacity int }
doorkeeper is a small bloom-filter-based cache admission policy
func New ¶
func New(falsePositiveRate float64) *Bloomfilter
func NewWithSize ¶
func NewWithSize(size uint32) *Bloomfilter
create new bloomfilter with given size in bytes
func (*Bloomfilter) EnsureCapacity ¶
func (d *Bloomfilter) EnsureCapacity(capacity int)
func (*Bloomfilter) Exist ¶
func (d *Bloomfilter) Exist(h uint64) bool
func (*Bloomfilter) Insert ¶
func (d *Bloomfilter) Insert(h uint64) bool
insert inserts the byte array b into the bloom filter. Returns true if the value was already considered to be in the bloom filter.
Click to show internal directories.
Click to hide internal directories.