fiorix/txredisapi — pull request #33 by dgvncsz0f (2012-12-20 23:16:05+00:00)
Title: Adding proper watch support and implements its dual, the unwatch command

This commit enables users to use the following pattern:

WATCH
GET
MULTI
EXEC/DISCARD

The old behavior have been kept intact, i.e., the multi function
continues to accept a list of keys to watch prior issuing the watch
command, although I believe this use should be deprecated.

The watch command may also be used standalone. In this case, users
should make use of the watch command to clear the `inTransaction'
state.

Some examples (the following assumes inlineCallbacks):

# 1. Using watch/unwatch
tx = yield conn.watch(...)
...
yield tx.unwatch()

# 2. Using watch/multi
tx = yield conn.watch(...)
...
yield tx.multi()
...
yield tx.commit()

# 3. Using watch only
tx = yield conn.multi(...)
...
yield tx.commit()

# 4. All together:
tx = yield conn.watch(...)
...
yield tx.multi()
...
yield tx.unwatch() # this will not clear
# the `inTransaction` state
...
yield tx.commit()