1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
Redis Modules Commands
######################
Accessing redis module commands requires the installation of the supported `Redis module <https://docs.redis.com/latest/modules/>`_. For a quick start with redis modules, try the `Redismod docker <https://hub.docker.com/r/redislabs/redismod>`_.
RedisBloom Commands
*******************
These are the commands for interacting with the `RedisBloom module <https://redisbloom.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
------
RedisGraph Commands
*******************
These are the commands for interacting with the `RedisGraph module <https://redisgraph.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
------
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!"]}
Examples of how to combine search and json can be found `here <examples/search_json_examples.html>`_.
.. automodule:: redis.commands.json.commands
:members: JSONCommands
-----
RediSearch Commands
*******************
These are the commands for interacting with the `RediSearch module <https://redisearch.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
from redis.commands.search.field import TextField
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
-----
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.ts().create(2, retension_msecs=5)
.. automodule:: redis.commands.timeseries.commands
:members: TimeSeriesCommands
|