Skip to content

Commit eaa3c61

Browse files
ashtulgkorland
authored andcommitted
README.md expanded (#2)
Add README
1 parent 1ae634d commit eaa3c61

File tree

2 files changed

+53
-17
lines changed

2 files changed

+53
-17
lines changed

README.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,59 @@
1+
# Python client for RedisBloom
12
[![license](https://img.shields.io/github/license/RedisBloom/redisbloom-py.svg)](https://github.com/RedisBloom/redisbloom-py)
23
[![PyPI version](https://badge.fury.io/py/redisbloom.svg)](https://badge.fury.io/py/redisbloom)
34
[![CircleCI](https://circleci.com/gh/RedisBloom/redisbloom-py/tree/master.svg?style=svg)](https://circleci.com/gh/RedisBloom/redisbloom-py/tree/master)
45
[![GitHub issues](https://img.shields.io/github/release/RedisBloom/redisbloom-py.svg)](https://github.com/RedisBloom/redisbloom-py/releases/latest)
56
[![Codecov](https://codecov.io/gh/RedisBloom/redisbloom-py/branch/master/graph/badge.svg)](https://codecov.io/gh/RedisBloom/redisbloom-py)
67

7-
# redisbloom-py
8-
Python client for Redisbloom
8+
redisbloom-py is a package that gives developers easy access to several probabilistic data structures. The package extends [redis-py](https://github.com/andymccurdy/redis-py)'s interface with RedisBloom's API.
9+
10+
### Installation
11+
```
12+
$ pip install redisbloom
13+
```
14+
15+
### Usage example
16+
17+
```sql
18+
# Using Bloom Filter
19+
from redisbloom import Client
20+
rb = Client()
21+
rb.bfCreate('bloom', 0.01, 1000)
22+
rb.bfAdd('bloom', 'foo') # returns 1
23+
rb.bfAdd('bloom', 'foo') # returns 0
24+
rb.bfExists('bloom', 'foo') # returns 1
25+
rb.bfExists('bloom', 'noexist') # returns 0
26+
27+
# Using Cuckoo Filter
28+
from redisbloom import Client
29+
rb = Client()
30+
rb.cfCreate('cuckoo', 1000)
31+
rb.cfAdd('cuckoo', 'filter') # returns 1
32+
rb.cfAddNX('cuckoo', 'filter') # returns 0
33+
rb.cfExists('cuckoo', 'filter') # returns 1
34+
rb.cfExists('cuckoo', 'noexist') # returns 0
35+
36+
# Using Cuckoo Filter
37+
from redisbloom import Client
38+
rb = Client()
39+
rb.cmsInitByDim('dim', 1000, 5)
40+
rb.cmsIncrBy('dim', ['foo'], [5])
41+
rb.cmsIncrBy('dim', ['foo', 'bar'], [5, 15])
42+
rb.cmsQuery('dim', 'foo', 'bar') # returns [10, 15]
43+
44+
# Using Cuckoo Filter
45+
from redisbloom import Client
46+
rb = Client()
47+
rb.topkReserve('topk', 3, 20, 3, 0.9)
48+
rb.topkAdd('topk', 'A', 'B', 'C', 'D', 'E', 'A', 'A', 'B',
49+
'C', 'G', 'D', 'B', 'D', 'A', 'E', 'E')
50+
rb.topkQuery('topk', 'A', 'B', 'C', 'D') # returns [1, 1, 0, 1]
51+
rb.topkCount('topk', 'A', 'B', 'C', 'D') # returns [4, 3, 2, 3]
52+
rb.topkList('topk') # returns ['D', 'A', 'B']
53+
```
54+
55+
### API
56+
For complete documentation about RedisBloom's commands, refer to [RedisBloom's website](http://redisbloom.io).
57+
58+
### License
59+
[BSD 3-Clause](https://github.com/RedisBloom/redisbloom-py/blob/master/LICENSE)

redisbloom/client.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,6 @@ class Client(Redis): #changed from StrictRedis
9090
TOPK_LIST = 'TOPK.LIST'
9191
TOPK_INFO = 'TOPK.INFO'
9292

93-
94-
CREATE_CMD = 'TS.CREATE'
95-
ALTER_CMD = 'TS.ALTER'
96-
ADD_CMD = 'TS.ADD'
97-
INCRBY_CMD = 'TS.INCRBY'
98-
DECRBY_CMD = 'TS.DECRBY'
99-
CREATERULE_CMD = 'TS.CREATERULE'
100-
DELETERULE_CMD = 'TS.DELETERULE'
101-
RANGE_CMD = 'TS.RANGE'
102-
MRANGE_CMD = 'TS.MRANGE'
103-
GET_CMD = 'TS.GET'
104-
MGET_CMD = 'TS.MGET'
105-
INFO_CMD = 'TS.INFO'
106-
QUERYINDEX_CMD = 'TS.QUERYINDEX'
107-
10893
def __init__(self, *args, **kwargs):
10994
"""
11095
Creates a new RedisBloom client.

0 commit comments

Comments
 (0)