Python client for RedisBloom
redisbloom-py is a package that gives developers easy access to several probabilistic data structures. The package extends redis-py's interface with RedisBloom's API.
Installation
$ pip install redisbloom
Usage example
# Using Bloom Filter
from redisbloom.client import Client
rb = Client()
rb.bfCreate('bloom', 0.01, 1000)
rb.bfAdd('bloom', 'foo') # returns 1
rb.bfAdd('bloom', 'foo') # returns 0
rb.bfExists('bloom', 'foo') # returns 1
rb.bfExists('bloom', 'noexist') # returns 0
# Using Cuckoo Filter
from redisbloom.client import Client
rb = Client()
rb.cfCreate('cuckoo', 1000)
rb.cfAdd('cuckoo', 'filter') # returns 1
rb.cfAddNX('cuckoo', 'filter') # returns 0
rb.cfExists('cuckoo', 'filter') # returns 1
rb.cfExists('cuckoo', 'noexist') # returns 0
# Using Count-Min Sketch
from redisbloom.client import Client
rb = Client()
rb.cmsInitByDim('dim', 1000, 5)
rb.cmsIncrBy('dim', ['foo'], [5])
rb.cmsIncrBy('dim', ['foo', 'bar'], [5, 15])
rb.cmsQuery('dim', 'foo', 'bar') # returns [10, 15]
# Using Top-K
from redisbloom.client import Client
rb = Client()
rb.topkReserve('topk', 3, 20, 3, 0.9)
rb.topkAdd('topk', 'A', 'B', 'C', 'D', 'E', 'A', 'A', 'B',
'C', 'G', 'D', 'B', 'D', 'A', 'E', 'E')
rb.topkQuery('topk', 'A', 'B', 'C', 'D') # returns [1, 1, 0, 1]
rb.topkCount('topk', 'A', 'B', 'C', 'D') # returns [4, 3, 2, 3]
rb.topkList('topk') # returns ['A', 'B', 'E']
rb.topkListWithCount('topk') # returns ['A', 4, 'B', 3, 'E', 3]
API
For complete documentation about RedisBloom's commands, refer to RedisBloom's website.
License
Development
- Create a virtualenv to manage your python dependencies, and ensure it's active.
virtualenv -v venv - Install pypoetry to manage your dependencies.
pip install poetry - Install dependencies.
poetry install
tox runs all tests as its default target. Running tox by itself will run unit tests. Ensure you have a running redis, with the module loaded.
Metadata
Release files for redisbloom 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| redisbloom-0.4.1.tar.gz | 9.5 kB | Without provenance | Details for redisbloom-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redisbloom-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for redisbloom-0.4.1-py3-none-any.whl |
Total release size: 17.8 kB
Release files / redisbloom-0.4.1.tar.gz
| Download URL | redisbloom-0.4.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
659c869fb2279b07051d2fc026fc7d632191ccc83586c8f377d14e38232f1f05
|
|
BLAKE2b-256 checksum How to use checksums |
4a4bc0daf17027c22414a2b27cb1e3b0366cac3e721c6eaad4b79b7d921cb919
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / redisbloom-0.4.1-py3-none-any.whl
| Download URL | redisbloom-0.4.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
714cd4d86a1cf67a9c0c23370cbbbf0e527e19a59268217e564dfea88d7bfe38
|
|
BLAKE2b-256 checksum How to use checksums |
94bf30ea2b23b69359d09bed9041f8b2d09ba53aadf5cc0704b1fe11046639f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for redisbloom 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.