@@ -12,25 +12,28 @@ These are the commands for interacting with the `RedisBloom module <https://redi
1212**Create and add to a bloom filter **
1313
1414.. 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" )
1920
2021 **Create and add to a cuckoo filter **
2122
2223.. code-block :: python
2324
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" )
2729
2830 **Create Count-Min Sketch and get information **
2931
3032.. code-block :: python
3133
3234 import redis
33- r = redis.cms().initbydim(" dim" , 1000 , 5 )
35+ r = redis.Redis()
36+ r.cms().initbydim(" dim" , 1000 , 5 )
3437 r.cms().incrby(" dim" , [" foo" ], [5 ])
3538 r.cms().info(" dim" )
3639
@@ -39,8 +42,9 @@ These are the commands for interacting with the `RedisBloom module <https://redi
3942.. code-block :: python
4043
4144 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)
4448
4549.. automodule:: redis.commands.bf.commands
4650 :members: BFCommands, CFCommands, CMSCommands, TOPKCommands
0 commit comments