File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -83,13 +83,16 @@ Consider the following example:
83
83
// Cluster is put into MULTI state locally
84
84
$obj_cluster->multi();
85
85
86
- for ($i = 0; $i < 10; $i++) {
87
- // MULTI will be delivered only once per node
88
- $obj_cluster->get("key:$i");
89
- }
86
+ // The cluster will issue MULTI on this node first (and only once)
87
+ $obj_cluster->get("mykey");
88
+ $obj_cluster->set("mykey", "new_value");
89
+
90
+ // If 'myotherkey' maps to a different node, MULTI will be issued there
91
+ // before requesting the key
92
+ $obj_cluster->get("myotherkey");
90
93
91
- // This always returns an array of 10 elements, of which some could be false
92
- // (for example if a slot had been migrated)
94
+ // This will always return an array, even in the event of a failed transaction
95
+ // on one of the nodes, in which case that element will be FALSE
93
96
print_r($obj_cluster->exec());
94
97
</pre >
95
98
You can’t perform that action at this time.
0 commit comments