Skip to content

Commit de5ca35

Browse files
committed
Updated docs
1 parent 6d1b150 commit de5ca35

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

docs/advanced_features.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Advanced Features
1+
from redis import RedisClusterAdvanced Features
22
=================
33

44
A note about threading
@@ -167,6 +167,7 @@ the server.
167167

168168
.. code:: python
169169
170+
>>> rc = RedisCluster()
170171
>>> with rc.pipeline() as pipe:
171172
... pipe.set('foo', 'value1')
172173
... pipe.set('bar', 'value2')
@@ -208,7 +209,7 @@ embedding them within a pipeline would eventually get ‘AttributeError’.
208209
With this approach, if the application uses ‘client.pipeline(transaction=True)’,
209210
then switching the client with a cluster-aware instance would simplify
210211
code changes (to some extent). This may be true for application code that
211-
makes use of hash keys, since its transactions may are already be
212+
makes use of hash keys, since its transactions may already be
212213
mapping all commands to the same slot.
213214

214215
An alternative is some kind of two-step commit solution, where a slot
@@ -220,14 +221,14 @@ transactional mode. To enable transactional context set:
220221

221222
.. code:: python
222223
223-
>>> p = r.pipeline(transaction=True)
224+
>>> p = rc.pipeline(transaction=True)
224225
225226
After entering the transactional context you can add commands to a transactional
226227
context, by one of the following ways:
227228

228229
.. code:: python
229230
230-
>>> p = r.pipeline(transaction=True) # Chaining commands
231+
>>> p = rc.pipeline(transaction=True) # Chaining commands
231232
>>> p.set("key", "value")
232233
>>> p.get("key")
233234
>>> response = p.execute()
@@ -236,7 +237,7 @@ Or
236237

237238
.. code:: python
238239
239-
>>> with r.pipeline(transaction=True) as pipe: # Using context manager
240+
>>> with rc.pipeline(transaction=True) as pipe: # Using context manager
240241
... pipe.set("key", "value")
241242
... pipe.get("key")
242243
... response = pipe.execute()
@@ -251,7 +252,7 @@ More information `here <https://redis.io/docs/latest/operate/oss_and_stack/refer
251252

252253
.. code:: python
253254
254-
>>> with r.pipeline(transaction=True) as pipe:
255+
>>> with rc.pipeline(transaction=True) as pipe:
255256
... pipe.set("{tag}foo", "bar")
256257
... pipe.set("{tag}bar", "foo")
257258
... pipe.get("{tag}foo")
@@ -273,7 +274,7 @@ transaction execution.
273274

274275
.. code:: python
275276
276-
>>> with r.pipeline(transaction=True) as pipe:
277+
>>> with rc.pipeline(transaction=True) as pipe:
277278
... pipe.watch("mykey") # Apply locking by immediately executing command
278279
... val = pipe.get("mykey") # Immediately retrieves value
279280
... val = val + 1 # Increment value

tests/test_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3099,7 +3099,7 @@ def test_multi_delete_unsupported_cross_slot(self, r):
30993099

31003100
def test_multi_delete_supported_single_slot(self, r):
31013101
"""
3102-
Test that multi delete operation is unsupported
3102+
Test that multi delete operation is supported when all keys are in the same hash slot
31033103
"""
31043104
with r.pipeline(transaction=True) as pipe:
31053105
r["{key}:a"] = 1

0 commit comments

Comments
 (0)