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(&block) # :nodoc:
- See: #unwatch -
See: #watch -
Returns:
-
(String, Array<...>)
-
Other tags:
- Yieldparam: multi - `self`
Other tags:
- Yield: - the commands that are called inside this block are cached
Other tags:
- Example: Without a block -
Example: With a block -
def multi(&block) # :nodoc: if block_given? if block&.arity == 0 Pipeline.deprecation_warning("multi", Kernel.caller_locations(1, 5)) end synchronize do |prior_client| pipeline = Pipeline::Multi.new(prior_client) pipelined_connection = PipelinedConnection.new(pipeline) yield pipelined_connection prior_client.call_pipeline(pipeline) end else send_command([:multi]) 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([:watch, *keys]) if block_given? begin yield(self) rescue ConnectionError raise rescue StandardError unwatch raise end else res end end end