@@ -12,25 +12,28 @@ These are the commands for interacting with the `RedisBloom module <https://redi
12
12
**Create and add to a bloom filter **
13
13
14
14
.. code-block :: python
15
-
16
- import redis
17
- filter = redis.bf().create(" bloom" , 0.01 , 1000 )
18
- filter .add(" bloom" , " foo" )
15
+
16
+ import redis
17
+ r = redis.Redis()
18
+ r.bf().create(" bloom" , 0.01 , 1000 )
19
+ r.bf().add(" bloom" , " foo" )
19
20
20
21
**Create and add to a cuckoo filter **
21
22
22
23
.. code-block :: python
23
24
24
- import redis
25
- filter = redis.cf().create(" cuckoo" , 1000 )
26
- filter .add(" cuckoo" , " filter" )
25
+ import redis
26
+ r = redis.Redis()
27
+ r.cf().create(" cuckoo" , 1000 )
28
+ r.cf().add(" cuckoo" , " filter" )
27
29
28
30
**Create Count-Min Sketch and get information **
29
31
30
32
.. code-block :: python
31
33
32
34
import redis
33
- r = redis.cms().initbydim(" dim" , 1000 , 5 )
35
+ r = redis.Redis()
36
+ r.cms().initbydim(" dim" , 1000 , 5 )
34
37
r.cms().incrby(" dim" , [" foo" ], [5 ])
35
38
r.cms().info(" dim" )
36
39
@@ -39,8 +42,9 @@ These are the commands for interacting with the `RedisBloom module <https://redi
39
42
.. code-block :: python
40
43
41
44
import redis
42
- r = redis.topk().reserve(" mytopk" , 3 , 50 , 4 , 0.9 )
43
- info = r.topk().info(" mytopk)
45
+ r = redis.Redis()
46
+ r.topk().reserve(" mytopk" , 3 , 50 , 4 , 0.9 )
47
+ r.topk().info(" mytopk)
44
48
45
49
.. automodule:: redis.commands.bf.commands
46
50
:members: BFCommands, CFCommands, CMSCommands, TOPKCommands
0 commit comments