Class: Async::Redis::Context::Transaction
- Defined in:
- lib/async/redis/context/transaction.rb
Instance Method Summary collapse
- #discard ⇒ Object
-
#execute ⇒ Object
Execute all queued commands, provided that no watched keys have been modified.
-
#initialize(pool, *arguments) ⇒ Transaction
constructor
A new instance of Transaction.
- #multi ⇒ Object
- #watch(*keys) ⇒ Object
Methods inherited from Pipeline
#call, #close, #collect, #flush, #read_response, #sync, #write_request
Methods inherited from Generic
#call, #close, #read_response, #write_request
Constructor Details
#initialize(pool, *arguments) ⇒ Transaction
Returns a new instance of Transaction.
30 31 32 |
# File 'lib/async/redis/context/transaction.rb', line 30 def initialize(pool, *arguments) super(pool) end |
Instance Method Details
#discard ⇒ Object
47 48 49 |
# File 'lib/async/redis/context/transaction.rb', line 47 def discard sync.call('DISCARD') end |
#execute ⇒ Object
Execute all queued commands, provided that no watched keys have been modified. It’s important to note that even when a command fails, all the other commands in the queue are processed – Redis will not stop the processing of commands.
43 44 45 |
# File 'lib/async/redis/context/transaction.rb', line 43 def execute sync.call('EXEC') end |
#multi ⇒ Object
34 35 36 |
# File 'lib/async/redis/context/transaction.rb', line 34 def multi call('MULTI') end |
#watch(*keys) ⇒ Object
38 39 40 |
# File 'lib/async/redis/context/transaction.rb', line 38 def watch(*keys) sync.call('WATCH', *keys) end |