Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BloomFilter

Bloom filter

Hierarchy

Index

Constructors

constructor

Properties

Protected Readonly client

client: Red

name

name: string

Protected Readonly options

options: Options

Methods

add

  • add(item: any): Promise<number>
  • Add an item to the filter

    Parameters

    • item: any

      Item

    Returns Promise<number>

    1 if item was newly added, 0 if it may have already existed

connect

  • connect(): Promise<void>

disconnect

  • disconnect(): Promise<void>

exists

  • exists(item: any): Promise<number>
  • Check whether an item may already exist in the filter

    Parameters

    • item: any

      Item

    Returns Promise<number>

    1 if item may exist, 0 if item certainly does not exist

info

  • info(): Promise<string[]>

madd

  • madd(items: any[]): Promise<number[]>
  • Add items to the filter

    Parameters

    • items: any[]

      Array of items

    Returns Promise<number[]>

    Array of integers, each is either 1 or 0 depending on whether the corresponding item was newly added or may have already existed

mexists

  • mexists(items: any[]): Promise<number[]>
  • Check whether items may already exist in the filter

    Parameters

    • items: any[]

      Array of items

    Returns Promise<number[]>

    Array of integers, each is either 1 or 0 depending on whether the corresponding item may exist or certainly does not exist

reserve

  • reserve(errorRate: number, capacity: number, expansionRate?: number): Promise<string>
  • Reserve space for the filter

    Parameters

    • errorRate: number

      The desired probability for false positives

    • capacity: number

      The number of entries intended to be added to the filter

    • Default value expansionRate: number = 2

      Expansion rate. If expansionRate <= 0, the filter is non-scalable.

    Returns Promise<string>

    OK on success, error otherwise

reset

  • reset(): Promise<number>