Skip to content

An implementation of cuckoo filter, better than bloom filter

License

Notifications You must be signed in to change notification settings

beaulian/cuckoofilter

Repository files navigation

cuckoofilter

Cuckoofilter is an implementation of Cuckoo Filter using Python, which is thread-safe. Besides, the package can both be used in python2.x and python3.x.

Cuckoo Filter

Cuckoo filter first appeared in the paper Cuckoo Filter: Practically Better Than Bloom by Bin Fan,David G. Andersen, Michael Kaminsky and Michael D. Mitzenmacher, which is used to replace Bloom filters for approximate set membership tests. Cuckoo filters support adding and removing items dynamically while achieving even higher performance than Bloom filters. For applications that store many items and target moderately low false positive rates, cuckoo filters have lower space overhead than space-optimized Bloom filters.

To know more details of Cuckoo Filter, please read the paper.

Installation

Install cuckoofilter:

   $ pip install cuckoofilter

Or

   $ pip3 install cuckoofilter

Usage

    >>> import cuckoofilter
    >>> cf = cuckoofilter.CuckooFilter(capacity=100, fingerprint_size=1)
    
    >>> cf.insert('test')
    True
    
    >>> cf.contains('test')
    True
    
    >>> cf.delete('test')
    True

Testing

To test the package and generate a test coverage report, you should run

   $ pip install pytest coverage pytest-cov
   $ pytest -v --cov=cuckoofilter --cov-report=html

Or

   $ pip3 install pytest coverage pytest-cov
   $ python3 -m pytest .

License

GPL-3.0 License

About

An implementation of cuckoo filter, better than bloom filter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages