Skip to content

pydrbloomfilter is a distributed implement of bloom filter which based on Redis. python bloomfilter with Redis

Notifications You must be signed in to change notification settings

paramiao/pydrbloomfilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pydrbloomfilter

pydrbloomfilter is a distributed implement of bloom filter which based on Redis.

It is very simple, I just use the commands that setbit and getbit of Redis to store the bitarray, and the bloom filter will be persisted in Redis(I just assume your redis server will persisted your data)

usecase:

init bloomfilter

redis_connection = {
    'host': '127.0.0.1',
    'port': 6379,
    'db': 0,
    'bfkey': 'bf'
}
pbl = pydrbloomfilter(10000000, 0.001, redis_connection)

add key to bloomfilter

pbl.add('hello world')

judge if bloom filter already contains the key

if 'hello world' in pbl:
    print True

or

print pbl.exists('hello world')

by default, the bloom filter will store in Redis, if you want to clear data, you can delete the bfkey of your redis_connection, or you can do as below:

pbl.clear()

thanks to Creating a Simple Bloom Filter

About

pydrbloomfilter is a distributed implement of bloom filter which based on Redis. python bloomfilter with Redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages