summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNermina Miller <102551568+nermiller@users.noreply.github.com>2022-11-30 09:30:28 -0500
committerGitHub <noreply@github.com>2022-11-30 09:30:28 -0500
commitdfe2152b162634c338aa05ae427d6024994ee7b8 (patch)
treeedec97c49e6657e2262d16d0b24d37311bc3018c
parentf492f85af723b277fa1ec99f01e6612e5d567b3f (diff)
downloadredis-py-dfe2152b162634c338aa05ae427d6024994ee7b8.tar.gz
Adding connection step to bloom filter examples (#2478)
* Fixes #2415, adds a connect step to bloom commands * Update redismodules.rst Apply feedback
-rw-r--r--docs/redismodules.rst24
1 files changed, 14 insertions, 10 deletions
diff --git a/docs/redismodules.rst b/docs/redismodules.rst
index cf31b29..f764d82 100644
--- a/docs/redismodules.rst
+++ b/docs/redismodules.rst
@@ -12,25 +12,28 @@ These are the commands for interacting with the `RedisBloom module <https://redi
**Create and add to a bloom filter**
.. code-block:: python
-
- import redis
- filter = redis.bf().create("bloom", 0.01, 1000)
- filter.add("bloom", "foo")
+
+ import redis
+ r = redis.Redis()
+ r.bf().create("bloom", 0.01, 1000)
+ r.bf().add("bloom", "foo")
**Create and add to a cuckoo filter**
.. code-block:: python
- import redis
- filter = redis.cf().create("cuckoo", 1000)
- filter.add("cuckoo", "filter")
+ import redis
+ r = redis.Redis()
+ r.cf().create("cuckoo", 1000)
+ r.cf().add("cuckoo", "filter")
**Create Count-Min Sketch and get information**
.. code-block:: python
import redis
- r = redis.cms().initbydim("dim", 1000, 5)
+ r = redis.Redis()
+ r.cms().initbydim("dim", 1000, 5)
r.cms().incrby("dim", ["foo"], [5])
r.cms().info("dim")
@@ -39,8 +42,9 @@ These are the commands for interacting with the `RedisBloom module <https://redi
.. code-block:: python
import redis
- r = redis.topk().reserve("mytopk", 3, 50, 4, 0.9)
- info = r.topk().info("mytopk)
+ r = redis.Redis()
+ r.topk().reserve("mytopk", 3, 50, 4, 0.9)
+ r.topk().info("mytopk)
.. automodule:: redis.commands.bf.commands
:members: BFCommands, CFCommands, CMSCommands, TOPKCommands