diff options
author | Chayim <chayim@users.noreply.github.com> | 2021-12-09 09:49:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 09:49:35 +0200 |
commit | 12c17bfc436ea6784bbc8b2d327d981520858eb7 (patch) | |
tree | 40cb053e6a10bffe70f528132265225c969b4467 /docs/redismodules.rst | |
parent | a58f4235e554cb50b312caf1a9076114c77d0529 (diff) | |
download | redis-py-12c17bfc436ea6784bbc8b2d327d981520858eb7.tar.gz |
Adding cluster, bloom, and graph docs (#1779)v4.1.0rc2
Diffstat (limited to 'docs/redismodules.rst')
-rw-r--r-- | docs/redismodules.rst | 123 |
1 files changed, 120 insertions, 3 deletions
diff --git a/docs/redismodules.rst b/docs/redismodules.rst index da8c36b..0cb8c49 100644 --- a/docs/redismodules.rst +++ b/docs/redismodules.rst @@ -5,15 +5,132 @@ Accessing redis module commands requires the installation of the supported `Redi RedisTimeSeries Commands ************************ + +These are the commands for interacting with the `RedisTimeSeries module <https://redistimeseries.io>`_. Below is a brief example, as well as documentation on the commands themselves. + + +**Create a timeseries object with 5 second retention** + +.. code-block:: python + + import redis + r = redis.Redis() + r.timeseries().create(2, retension_msecs=5) + .. automodule:: redis.commands.timeseries.commands - :members: TimeSeriesCommands + :members: TimeSeriesCommands + +----- RedisJSON Commands ****************** + +These are the commands for interacting with the `RedisJSON module <https://redisjson.io>`_. Below is a brief example, as well as documentation on the commands themselves. + +**Create a json object** + +.. code-block:: python + + import redis + r = redis.Redis() + r.json().set("mykey", ".", {"hello": "world", "i am": ["a", "json", "object!"]} + + .. automodule:: redis.commands.json.commands - :members: JSONCommands + :members: JSONCommands + +----- RediSearch Commands ******************* + +These are the commands for interacting with the `RediSearch module <https://redisjson.io>`_. Below is a brief example, as well as documentation on the commands themselves. + +**Create a search index, and display its information** + +.. code-block:: python + + import redis + r = redis.Redis() + r.ft().create_index(TextField("play", weight=5.0), TextField("ball")) + print(r.ft().info()) + + .. automodule:: redis.commands.search.commands - :members: SearchCommands
\ No newline at end of file + :members: SearchCommands + +----- + +RedisGraph Commands +******************* + +These are the commands for interacting with the `RedisGraph module <https://redisjson.io>`_. Below is a brief example, as well as documentation on the commands themselves. + +**Create a graph, adding two nodes** + +.. code-block:: python + + import redis + from redis.graph.node import Node + + john = Node(label="person", properties={"name": "John Doe", "age": 33} + jane = Node(label="person", properties={"name": "Jane Doe", "age": 34} + + r = redis.Redis() + graph = r.graph() + graph.add_node(john) + graph.add_node(jane) + graph.add_node(pat) + graph.commit() + +.. automodule:: redis.commands.graph.node + :members: Node + +.. automodule:: redis.commands.graph.edge + :members: Edge + +.. automodule:: redis.commands.graph.commands + :members: GraphCommands + +----- + +RedisBloom Commands +******************* + +These are the commands for interacting with the `RedisBloom module <https://redisjson.io>`_. Below is a brief example, as well as documentation on the commands themselves. + +**Create and add to a bloom filter** + +.. code-block:: python + + import redis + filter = redis.bf().create("bloom", 0.01, 1000) + filter.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") + +**Create Count-Min Sketch and get information** + +.. code-block:: python + + import redis + r = redis.cms().initbydim("dim", 1000, 5) + r.cms().incrby("dim", ["foo"], [5]) + r.cms().info("dim") + +**Create a topk list, and access the results** + +.. code-block:: python + + import redis + r = redis.topk().reserve("mytopk", 3, 50, 4, 0.9) + info = r.topk().info("mytopk) + +.. automodule:: redis.commands.bf.commands + :members: BFCommands, CFCommands, CMSCommands, TOPKCommands |