diff options
author | michael-grunder <michael.grunder@gmail.com> | 2015-03-09 22:31:58 +0300 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2015-05-06 01:19:30 +0300 |
commit | 16438cb21b4e1d2f0f2c146e3e9b625598fd5e5c (patch) | |
tree | 202ca9993f2d3d22719bfaa15d8ddb2e9ed49528 /cluster.markdown | |
parent | 432bb9500bbe0b394c1ef894c31e4f8f0f35f154 (diff) |
Better MUTLI EXEC explanation
Diffstat (limited to 'cluster.markdown')
-rw-r--r-- | cluster.markdown | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cluster.markdown b/cluster.markdown index 9783b1dc..5c40eaf3 100644 --- a/cluster.markdown +++ b/cluster.markdown @@ -83,13 +83,16 @@ Consider the following example: // Cluster is put into MULTI state locally $obj_cluster->multi(); -for ($i = 0; $i < 10; $i++) { - // MULTI will be delivered only once per node - $obj_cluster->get("key:$i"); -} +// The cluster will issue MULTI on this node first (and only once) +$obj_cluster->get("mykey"); +$obj_cluster->set("mykey", "new_value"); + +// If 'myotherkey' maps to a different node, MULTI will be issued there +// before requesting the key +$obj_cluster->get("myotherkey"); -// This always returns an array of 10 elements, of which some could be false -// (for example if a slot had been migrated) +// This will always return an array, even in the event of a failed transaction +// on one of the nodes, in which case that element will be FALSE print_r($obj_cluster->exec()); </pre> |