README code snippets formatted to highlight properly
@@ -1160,11 +1160,11 @@ readwrite() method.
>>> from cluster import RedisCluster as Redis
# Use 'debug' log level to print the node that the command is executed on
>>> rc_readonly = Redis(startup_nodes=startup_nodes,
- read_from_replicas=True)
+... read_from_replicas=True)
>>> rc_readonly.set('{foo}1', 'bar1')
>>> for i in range(0, 4):
- # Assigns read command to the slot's hosts in a Round-Robin manner
- >>> rc_readonly.get('{foo}1')
+... # Assigns read command to the slot's hosts in a Round-Robin manner
+... rc_readonly.get('{foo}1')
# set command would be directed only to the slot's primary node
>>> rc_readonly.set('{foo}2', 'bar2')
# reset READONLY flag
@@ -1188,15 +1188,16 @@ client and the server.
``` pycon
>>> with rc.pipeline() as pipe:
- >>> pipe.set('foo', 'value1')
- >>> pipe.set('bar', 'value2')
- >>> pipe.get('foo')
- >>> pipe.get('bar')
- >>> print(pipe.execute())
+... pipe.set('foo', 'value1')
+... pipe.set('bar', 'value2')
+... pipe.get('foo')
+... pipe.get('bar')
+... print(pipe.execute())
[True, True, b'value1', b'value2']
- >>> pipe.set('foo1', 'bar1').get('foo1').execute()
+... pipe.set('foo1', 'bar1').get('foo1').execute()
[True, b'bar1']
```
+
Please note:
- RedisCluster pipelines currently only support key-based commands.
- The pipeline gets its 'read_from_replicas' value from the cluster's parameter.
