Permalink
Browse files

document transaction support

  • Loading branch information...
1 parent ea9a553 commit cccd328b98b369efe7d07696b2b709826f0f3095 Chip committed Jan 26, 2011
Showing with 29 additions and 7 deletions.
  1. +19 −0 README
  2. +10 −7 lib/AnyEvent/Redis.pm
View
19 README
@@ -87,6 +87,23 @@ METHODS
(Callback is a wrapper around the $cv approach.)
+ Transactions (MULTI/EXEC)
+ Redis transactions begin with a "multi" command and end with an "exec"
+ command. Commands issued in between are not executed immediately; on
+ receipt of the "exec", the server executes all commands atomically, and
+ returns all the results as one bulk reply. Therefore, by the time any of
+ these callbacks is called, the entire transaction is finished for better
+ or worse.
+
+ After a transaction is finished, results for each individual command are
+ reported in the usual way. Results of the "exec" itself will be returned
+ as an array reference containing all of the individual results. This may
+ in some cases make callbacks on the individual commands unnecessary, or
+ vice versa.
+
+ It is not permitted to nest transactions. This module does not permit
+ subscription-related commands in a transaction.
+
Subscriptions
The subscription methods ("subscribe" and "psubscribe") must be used
with a callback:
@@ -147,6 +164,8 @@ AUTHORS
Michael S. Fischer
+ Chip Salzenberg
+
SEE ALSO
Redis, AnyEvent
View
@@ -377,17 +377,20 @@ There are two alternative approaches for handling results from commands:
=head2 Transactions (MULTI/EXEC)
Redis transactions begin with a "multi" command and end with an "exec"
-command. Commands issued in between are not executed immediately; on
-receipt of the "exec", the server executes all commands atomically, and
-returns all the results as one bulk reply. Therefore, by the time any of
-these callbacks is called, the entire transaction is finished for better or
-worse.
+command. Commands in between are not executed immediately when they're
+sent. On receipt of the "exec", the server executes all the saved commands
+atomically, and returns all their results as one bulk reply.
After a transaction is finished, results for each individual command are
-reported in the usual way. Results of the "exec" itself will be returned as
+reported in the usual way. Thus, by the time any of these callbacks is
+called, the entire transaction is finished for better or worse.
+
+Results of the "exec" (containing all the other results) will be returned as
an array reference containing all of the individual results. This may in
some cases make callbacks on the individual commands unnecessary, or vice
-versa.
+versa. In this bulk reply, errors reported for each individual command are
+represented by objects of class C<AnyEvent::Redis::Error>, which will
+respond to a C<< ->message >> method call with that error message.
It is not permitted to nest transactions. This module does not permit
subscription-related commands in a transaction.

0 comments on commit cccd328

Please sign in to comment.