Class: Async::Redis::Context::Transaction

Inherits:
Pipeline show all
Defined in:
lib/async/redis/context/transaction.rb

Instance Method Summary collapse

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.



13
14
15
# File 'lib/async/redis/context/transaction.rb', line 13

def initialize(pool, *arguments)
  super(pool)
end

Instance Method Details

#discardObject



30
31
32
# File 'lib/async/redis/context/transaction.rb', line 30

def discard
  sync.call('DISCARD')
end

#executeObject

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.



26
27
28
# File 'lib/async/redis/context/transaction.rb', line 26

def execute
  sync.call('EXEC')
end

#multiObject



17
18
19
# File 'lib/async/redis/context/transaction.rb', line 17

def multi
  call('MULTI')
end

#watch(*keys) ⇒ Object



21
22
23
# File 'lib/async/redis/context/transaction.rb', line 21

def watch(*keys)
  sync.call('WATCH', *keys)
end