new BloomFilter(sizeopt, slicesopt, bufferopt)
Classic Bloom filter dimensioned by the size of the bitfield and the number of hash functions.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
size | number | <optional> | 16 | Total bits in the underlying buffer |
slices | number | <optional> | 2 | Number of hash functions |
buffer | Buffer | <optional> | Buffer.alloc(size) | Underlying buffer to use |
- Source
Methods
add(key) → {BloomFilter}
Add an item to the Bloom filter.
Parameters:
Name | Type | Description |
---|---|---|
key | string | | Item to add |
- Source
Returns:
- Type:
- BloomFilter
has(key) → {boolean}
Check if an item probably exists in the Bloom filter
Parameters:
Name | Type | Description |
---|---|---|
key | string | | Item to check |
- Source
Returns:
- Type:
- boolean
(static) destringify(data) → {BloomFilter}
Create a BloomFilter from an object.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | object | Properties
|
- Source
Returns:
- Type:
- BloomFilter