| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.Redis.Transactions
Documentation
Arguments
| :: [ByteString] | key |
| -> Redis (Either Reply Status) |
Watch the given keys to determine execution of the MULTI/EXEC block (http://redis.io/commands/watch).
unwatch :: Redis (Either Reply Status) Source #
Forget about all watched keys (http://redis.io/commands/unwatch).
multiExec :: RedisTx (Queued a) -> Redis (TxResult a) Source #
Run commands inside a transaction. For documentation on the semantics of Redis transaction see http://redis.io/topics/transactions.
Inside the transaction block, command functions return their result wrapped
in a Queued. The Queued result is a proxy object for the actual
command's result, which will only be available after EXECing the
transaction.
Example usage (note how Queued 's Applicative instance is used to
combine the two individual results):
runRedis conn $ do
set "hello" "hello"
set "world" "world"
helloworld <- multiExec $ do
hello <- get "hello"
world <- get "world"
return $ (,) <$> hello <*> world
liftIO (print helloworld)
A Queued value represents the result of a command inside a transaction. It
is a proxy object for the actual result, which will only be available
after returning from a multiExec transaction.
Queued values are composable by utilizing the Functor, Applicative or
Monad interfaces.
Result of a multiExec transaction.
Constructors
| TxSuccess a | Transaction completed successfully. The wrapped value corresponds to
the |
| TxAborted | Transaction aborted due to an earlier |
| TxError String | At least one of the commands returned an |
Instances
Command-context inside of MULTI/EXEC transactions. Use multiExec to run
actions of this type.
In the RedisTx context, all commands return a Queued value. It is a
proxy object for the actual result, which will only be available after
finishing the transaction.
Instances
| MonadIO RedisTx Source # | |
Defined in Database.Redis.Transactions | |
| Applicative RedisTx Source # | |
| Functor RedisTx Source # | |
| Monad RedisTx Source # | |
| MonadRedis RedisTx Source # | |
| RedisCtx RedisTx Queued Source # | |
Defined in Database.Redis.Transactions Methods returnDecode :: RedisResult a => Reply -> RedisTx (Queued a) Source # | |