@@ -107,14 +107,21 @@ This code does NOT wrap `MULTI/EXEC` around the commands when packed
107
107
.. code-block :: python
108
108
109
109
>> > from rediscluster import RedisCluster as s
110
+
110
111
>> > r = s(startup_nodes = [{" host" : " 127.0.0.1" , " port" : " 7002" }])
112
+
111
113
>> > # Simulate that a slot is migrating to another node
112
- >> > r.connection_pool.nodes.slots[14226 ] = {' host' : ' 127.0.0.1' , ' server_type' : ' master' , ' port' : 7001 , ' name' : ' 127.0.0.1:7001' }
114
+ >> > r.connection_pool.nodes.slots[14226 ] = [{
115
+ >> > ' host' : ' 127.0.0.1' ,
116
+ >> > ' server_type' : ' master' ,
117
+ >> > ' port' : 7001 ,
118
+ >> > ' name' : ' 127.0.0.1:7001' ,
119
+ >> > }]
120
+
113
121
>> > p = r.pipeline()
114
- >> > p.command_stack = []
115
- >> > p.command_stack.append(([" SET" , " ert" , " tre" ], {}))
116
- >> > p.command_stack.append(([" SET" , " wer" , " rew" ], {}))
117
- >> > p.execute()
122
+ >> > p.set(' ert' , ' tre' )
123
+ >> > p.set(' wer' , ' rew' )
124
+ >> > print (p.execute())
118
125
119
126
ClusterConnection< host= 127.0 .0.1,port= 7001 >
120
127
[True , ResponseError(' MOVED 14226 127.0.0.1:7002' ,)]
@@ -126,14 +133,22 @@ This code DO wrap MULTI/EXEC around the commands when packed
126
133
.. code-block :: python
127
134
128
135
>> > from rediscluster import RedisCluster as s
136
+
129
137
>> > r = s(startup_nodes = [{" host" : " 127.0.0.1" , " port" : " 7002" }])
138
+
130
139
>> > # Simulate that a slot is migrating to another node
131
- >> > r.connection_pool.nodes.slots[14226 ] = {' host' : ' 127.0.0.1' , ' server_type' : ' master' , ' port' : 7001 , ' name' : ' 127.0.0.1:7001' }
140
+ >> > r.connection_pool.nodes.slots[14226 ] = [{
141
+ >> > ' host' : ' 127.0.0.1' ,
142
+ >> > ' server_type' : ' master' ,
143
+ >> > ' port' : 7001 ,
144
+ >> > ' name' : ' 127.0.0.1:7001' ,
145
+ >> > }]
146
+
132
147
>> > p = r.pipeline()
133
- >> > p.command_stack = []
134
- >> > p.command_stack.append(([ " SET " , " ert " , " tre " ], {}) )
135
- >> > p.command_stack.append(([ " SET " , " wer " , " rew " ], {} ))
136
- >> > p.execute()
148
+ >> > p.set( ' ert ' , ' tre ' )
149
+ >> > p.set( ' wer ' , ' rew ' )
150
+ >> > print (p.execute( ))
151
+
137
152
ClusterConnection< host= 127.0 .0.1,port= 7001 >
138
153
[True , False ]
139
154
0 commit comments