diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/commands.rst | 30 | ||||
-rw-r--r-- | docs/connections.rst | 35 | ||||
-rw-r--r-- | docs/index.rst | 4 | ||||
-rw-r--r-- | docs/redis_cluster_commands.rst | 7 | ||||
-rw-r--r-- | docs/redis_commands.rst | 14 | ||||
-rw-r--r-- | docs/redismodules.rst | 115 | ||||
-rw-r--r-- | docs/sentinel_commands.rst | 20 |
7 files changed, 123 insertions, 102 deletions
diff --git a/docs/commands.rst b/docs/commands.rst new file mode 100644 index 0000000..d35f290 --- /dev/null +++ b/docs/commands.rst @@ -0,0 +1,30 @@ +Redis Commands +############## + +Core Commands +************* + +The following functions can be used to replicate their equivalent `Redis command <https://redis.io/commands>`_. Generally they can be used as functions on your redis connection. For the simplest example, see below: + +Getting and settings data in redis:: + + import redis + r = redis.Redis(decode_responses=True) + r.set('mykey', 'thevalueofmykey') + r.get('mykey') + +.. autoclass:: redis.commands.core.CoreCommands + :inherited-members: + +Sentinel Commands +***************** +.. autoclass:: redis.commands.sentinel.SentinelCommands + :inherited-members: + +Redis Cluster Commands +********************** + +The following `Redis commands <https://redis.io/commands>`_ are available within a `Redis Cluster <https://redis.io/topics/cluster-tutorial>`_. Generally they can be used as functions on your redis connection. + +.. autoclass:: redis.commands.cluster.RedisClusterCommands + :inherited-members: diff --git a/docs/connections.rst b/docs/connections.rst index 973821b..cf4657b 100644 --- a/docs/connections.rst +++ b/docs/connections.rst @@ -3,10 +3,41 @@ Connecting to Redis Generic Client ************** -.. autoclass:: redis.client.Redis + +This is the client used to connect directly to a standard redis node. + +.. autoclass:: redis.Redis + :members: + +Sentinel Client +*************** + +Redis `Sentinel <https://redis.io/topics/sentinel>`_ provides high availability for Redis. There are commands that can only be executed against a redis node running in sentinel mode. Connecting to those nodes, and executing commands against them requires a Sentinel connection. + +Connection example (assumes redis redis on the ports listed below): + + >>> from redis import Sentinel + >>> sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1) + >>> sentinel.discover_master('mymaster') + ('127.0.0.1', 6379) + >>> sentinel.discover_slaves('mymaster') + [('127.0.0.1', 6380)] + +.. autoclass:: redis.sentinel.Sentinel + :members: + +.. autoclass:: redis.sentinel.SentinelConnectionPool + :members: + +Cluster Client +************** + +This client is used for connecting to a redis cluser. + +.. autoclass:: redis.cluster.RedisCluster :members: Connection Pools ***************** .. autoclass:: redis.connection.ConnectionPool - :members:
\ No newline at end of file + :members: diff --git a/docs/index.rst b/docs/index.rst index cbf5115..51b38a2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -56,9 +56,7 @@ Redis Command Functions .. toctree:: :maxdepth: 2 - redis_commands - redis_cluster_commands - sentinel_commands + commands redismodules Module Documentation diff --git a/docs/redis_cluster_commands.rst b/docs/redis_cluster_commands.rst deleted file mode 100644 index de520de..0000000 --- a/docs/redis_cluster_commands.rst +++ /dev/null @@ -1,7 +0,0 @@ -Redis Cluster Commands -###################### - -The following `Redis commands <https://redis.io/commands>`_ are available within a `Redis Cluster <https://redis.io/topics/cluster-tutorial>`_. Generally they can be used as functions on your redis connection. - -.. autoclass:: redis.commands.cluster.RedisClusterCommands - :inherited-members: diff --git a/docs/redis_commands.rst b/docs/redis_commands.rst deleted file mode 100644 index efb76e7..0000000 --- a/docs/redis_commands.rst +++ /dev/null @@ -1,14 +0,0 @@ -Redis Commands -############### - -The following functions can be used to replicate their equivalent `Redis command <https://redis.io/commands>`_. Generally they can be used as functions on your redis connection. For the simplest example, see below: - -Getting and settings data in redis:: - - import redis - r = redis.Redis(decode_responses=True) - r.set('mykey', 'thevalueofmykey') - r.get('mykey') - -.. autoclass:: redis.commands.core.CoreCommands - :inherited-members: diff --git a/docs/redismodules.rst b/docs/redismodules.rst index 53a5008..f311675 100644 --- a/docs/redismodules.rst +++ b/docs/redismodules.rst @@ -3,63 +3,49 @@ 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>`_. -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. +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 a timeseries object with 5 second retention** +**Create and add to a bloom filter** .. code-block:: python import redis - r = redis.Redis() - r.timeseries().create(2, retension_msecs=5) - -.. automodule:: redis.commands.timeseries.commands - :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. + filter = redis.bf().create("bloom", 0.01, 1000) + filter.add("bloom", "foo") -**Create a json object** +**Create and add to a cuckoo filter** .. 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 + filter = redis.cf().create("cuckoo", 1000) + filter.add("cuckoo", "filter") ------ +**Create Count-Min Sketch and get information** -RediSearch Commands -******************* +.. code-block:: python -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. + import redis + r = redis.cms().initbydim("dim", 1000, 5) + r.cms().incrby("dim", ["foo"], [5]) + r.cms().info("dim") -**Create a search index, and display its information** +**Create a topk list, and access the results** .. code-block:: python import redis - r = redis.Redis() - r.ft().create_index(TextField("play", weight=5.0), TextField("ball")) - print(r.ft().info()) - + r = redis.topk().reserve("mytopk", 3, 50, 4, 0.9) + info = r.topk().info("mytopk) -.. automodule:: redis.commands.search.commands - :members: SearchCommands +.. automodule:: redis.commands.bf.commands + :members: BFCommands, CFCommands, CMSCommands, TOPKCommands ------ +------ RedisGraph Commands ******************* @@ -92,45 +78,62 @@ These are the commands for interacting with the `RedisGraph module <https://redi .. automodule:: redis.commands.graph.commands :members: GraphCommands ------ +------ -RedisBloom Commands -******************* +RedisJSON 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. +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 and add to a bloom filter** +**Create a json object** .. code-block:: python import redis - filter = redis.bf().create("bloom", 0.01, 1000) - filter.add("bloom", "foo") + r = redis.Redis() + r.json().set("mykey", ".", {"hello": "world", "i am": ["a", "json", "object!"]} -**Create and add to a cuckoo filter** -.. code-block:: python +.. automodule:: redis.commands.json.commands + :members: JSONCommands - import redis - filter = redis.cf().create("cuckoo", 1000) - filter.add("cuckoo", "filter") +----- -**Create Count-Min Sketch and get information** +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 - r = redis.cms().initbydim("dim", 1000, 5) - r.cms().incrby("dim", ["foo"], [5]) - r.cms().info("dim") + r = redis.Redis() + r.ft().create_index(TextField("play", weight=5.0), TextField("ball")) + print(r.ft().info()) -**Create a topk list, and access the results** + +.. 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.topk().reserve("mytopk", 3, 50, 4, 0.9) - info = r.topk().info("mytopk) + r = redis.Redis() + r.timeseries().create(2, retension_msecs=5) + +.. automodule:: redis.commands.timeseries.commands + :members: TimeSeriesCommands + -.. automodule:: redis.commands.bf.commands - :members: BFCommands, CFCommands, CMSCommands, TOPKCommands diff --git a/docs/sentinel_commands.rst b/docs/sentinel_commands.rst deleted file mode 100644 index e5be11e..0000000 --- a/docs/sentinel_commands.rst +++ /dev/null @@ -1,20 +0,0 @@ -Redis Sentinel Commands -======================= - -redis-py can be used together with `Redis -Sentinel <https://redis.io/topics/sentinel>`_ to discover Redis nodes. You -need to have at least one Sentinel daemon running in order to use -redis-py's Sentinel support. - -Connection example (assumes redis redis on the ports listed below): - - >>> from redis import Sentinel - >>> sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1) - >>> sentinel.discover_master('mymaster') - ('127.0.0.1', 6379) - >>> sentinel.discover_slaves('mymaster') - [('127.0.0.1', 6380)] - - -.. autoclass:: redis.commands.sentinel.SentinelCommands - :members:
\ No newline at end of file |