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.



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

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

Instance Method Details

#discardObject



47
48
49
# File 'lib/async/redis/context/transaction.rb', line 47

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.



43
44
45
# File 'lib/async/redis/context/transaction.rb', line 43

def execute
	sync.call('EXEC')
end

#multiObject



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