module Redis::Commands::Transactions
def discard
- See: #exec -
See: #multi -
Returns:
-
(String)
- `"OK"`
def discard send_command([:discard]) end
def exec
- See: #discard -
See: #multi -
Returns:
-
(nil, Array<...>)
-
def exec send_command([:exec]) end
def multi
- See: #unwatch -
See: #watch -
Returns:
-
(Array<...>)
-
Other tags:
- Yieldparam: multi - `self`
Other tags:
- Yield: - the commands that are called inside this block are cached
Other tags:
- Example: With a block -
def multi synchronize do |client| client.multi do |raw_transaction| yield MultiConnection.new(raw_transaction) end end end
def unwatch
- See: #multi -
See: #watch -
Returns:
-
(String)
- `OK`
def unwatch send_command([:unwatch]) end
def watch(*keys)
- See: #multi -
See: #unwatch -
Returns:
-
(String)
- if not using a block, returns `OK` -
(Object)
- if using a block, returns the return value of the block
Parameters:
-
keys
(String, Array
) -- one or more keys to watch
Other tags:
- Example: Without a block -
Example: With a block -
def watch(*keys) synchronize do |client| res = client.call_v([:watch] + keys) if block_given? begin yield(self) rescue ConnectionError raise rescue StandardError unwatch raise end else res end end end