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, *args) ⇒ Transaction

Returns a new instance of Transaction.



28
29
30
# File 'lib/async/redis/context/transaction.rb', line 28

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

Instance Method Details

#discardObject



45
46
47
# File 'lib/async/redis/context/transaction.rb', line 45

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.



41
42
43
# File 'lib/async/redis/context/transaction.rb', line 41

def execute
	sync.call('EXEC')
end

#multiObject



32
33
34
# File 'lib/async/redis/context/transaction.rb', line 32

def multi
	call('MULTI')
end

#watch(*keys) ⇒ Object



36
37
38
# File 'lib/async/redis/context/transaction.rb', line 36

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