class

Redis::TransactionApi

Inherits Redis::CommandExecution::FutureOriented / Redis::Commands / Reference / Object

API for sending commands in a transaction.

Used in Redis#multi.

Example:

redis.multi do |multi|
  multi.set("foo1", "first")
  multi.set("foo2", "second")
end

In this example, the multi object passed to the block is a TransactionApi object.

Constructors

new(strategy : Redis::Strategy::Transaction, namespace : String = "")
Source

Instance methods

discard

Aborts the current transaction.

Example:

redis.multi do |multi|
  multi.set("foo", "the new value")
  multi.discard
end
Source