class Redis::TransactionApi


API for sending commands in a transaction.

Used in Redis#multi.


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

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

Included Modules

Defined in:



Instance Method Summary

Instance methods inherited from module Redis::CommandExecution::FutureOriented

array_or_nil_command(request : Request) : Redis::Future array_or_nil_command, integer_array_command(request : Request) : Redis::Future integer_array_command, integer_command(request : Request) : Redis::Future integer_command, integer_or_nil_command(request : Request) : Redis::Future integer_or_nil_command, string_array_command(request : Request) : Redis::Future string_array_command, string_array_or_integer_command(request : Request) : Redis::Future string_array_or_integer_command, string_array_or_string_command(request : Request) : Redis::Future string_array_or_string_command, string_array_or_string_or_integer_command(request : Request) : Redis::Future string_array_or_string_or_integer_command, string_array_or_string_or_nil_command(request : Request) : Redis::Future string_array_or_string_or_nil_command, string_command(request : Request) : Redis::Future string_command, string_or_nil_command(request : Request) : Redis::Future string_or_nil_command, void_command(request : Request) : Redis::Future void_command

Instance methods inherited from module Redis::Commands

append(key, value) append, auth(password) auth, bitcount(key, from = nil, to = nil) bitcount, bitop(operation, key, *keys : String) : Int64
bitop(operation, key, keys : Array(String)) : Int64
, bitpos(key, bit, start = nil, to = nil) bitpos, blpop(keys, timeout_in_seconds) blpop, brpop(keys, timeout_in_seconds) brpop, brpoplpush(source, destination, timeout_in_seconds = nil) brpoplpush, decr(key) decr, decrby(key, decrement) decrby, del(keys : Array)
, dump(key) dump, echo(message) echo, eval(script : String, keys = [] of RedisValue, args = [] of RedisValue) eval, evalsha(sha1, keys = [] of RedisValue, args = [] of RedisValue) evalsha, exists(key) exists, expire(key, seconds) expire, expireat(key, unix_date) expireat, flushall flushall, flushdb flushdb, geoadd(key, longitude, latitude, place) geoadd, geodist(key, member1, member2, unit = nil) geodist, geohash(key, *args) geohash, geopos(key, *args) geopos, georadius(key, longitude, latitude, radius, unit, withcoord = nil, withdist = nil, withhash = nil, count = nil, sort = nil) georadius, georadiusbymember(key, member, radius, unit, withcoord = nil, withdist = nil, withhash = nil, count = nil, sort = nil) georadiusbymember, get(key) get, getbit(key, index) getbit, getrange(key, start_index, end_index) getrange, getset(key, value) getset, hdel(key, field) hdel, hexists(key, field) hexists, hget(key, field) hget, hgetall(key) hgetall, hincrby(key, field, increment) hincrby, hincrbyfloat(key, field, increment) hincrbyfloat, hkeys(key) hkeys, hlen(key) hlen, hmget(key, fields : Array(String))
hmget(key, *fields : String)
, hmset(key, hash) hmset, hscan(key, cursor, match = nil, count = nil) hscan, hset(key, field, value) hset, hsetnx(key, field, value) hsetnx, hvals(key) hvals, incr(key) incr, incrby(key, increment) incrby, incrbyfloat(key, increment) incrbyfloat, info(section : String? = nil) info, keys(pattern) keys, lindex(key, index) lindex, linsert(key, where, pivot, value) linsert, llen(key) llen, lpop(key) lpop, lpush(key, *values)
lpush(key, values : Array(RedisValue))
, lpushx(key, value) lpushx, lrange(key, from, to) lrange, lrem(key, count, value) lrem, lset(key, index, value) lset, ltrim(key, start, stop) ltrim, mget(keys : Array(String)) : Array(RedisValue)
, mset(hash : Hash) mset, msetnx(hash) msetnx, object_encoding(key) object_encoding, object_idletime(key) object_idletime, object_refcount(key) object_refcount, persist(key) persist, pexpire(key, milis) pexpire, pexpireat(key, unix_date_in_millis) pexpireat, pfadd(key, *values : String) : Int64
pfadd(key, values : Array(String)) : Int64
, pfcount(keys : Array(String)) : Int64
pfcount(*keys : String) : Int64
, pfmerge(*keys : String)
pfmerge(keys : Array(String))
, ping ping, psetex(key, expire_in_milis, value) psetex, psubscribe(*channel_patterns, &callback_setup_block : Subscription -> )
psubscribe(channel_patterns : Array(String))
, pttl(key) pttl, publish(channel, message) publish, punsubscribe(*channel_patterns)
punsubscribe(channel_patterns : Array(String))
, quit quit, randomkey randomkey, rename(old_key, new_key) rename, renamenx(old_key, new_key) renamenx, restore(key, ttl_in_milis : Int, serialized_value : String, replace = false) restore, rpop(key) rpop, rpoplpush(source, destination) rpoplpush, rpush(key, *values : String)
rpush(key, values : Array(RedisValue))
, rpushx(key, value) rpushx, sadd(key, *values)
sadd(key, values : Array(RedisValue))
, scan(cursor, match = nil, count = nil) scan, scard(key) scard, script_exists(sha1_array : Array(Reference)) script_exists, script_flush script_flush, script_kill script_kill, script_load(script : String) script_load, sdiff(keys : Array(String)) : Array(RedisValue)
sdiff(*keys : String) : Array(RedisValue)
, sdiffstore(destination, *keys : String) : Int64
sdiffstore(destination, keys : Array(String)) : Int64
, select(database_number) select, set(key, value, ex = nil, px = nil, nx = nil, xx = nil) set, setbit(key, index, value) setbit, setex(key, expire_in_seconds, value) setex, setnx(key, value) setnx, setrange(key, start_index, value) setrange, sinter(keys : Array(String)) : Array(RedisValue)
sinter(*keys : String) : Array(RedisValue)
, sinterstore(destination_key, *keys : String) : Int64
sinterstore(destination_key, keys : Array(String)) : Int64
, sismember(key, value) sismember, smembers(key) smembers, smove(source, destination, member) smove, sort(key, by = nil, limit = nil, get : Array(RedisValue)? = nil, order = "ASC", alpha = false, store = nil) sort, spop(key, count = nil) spop, srandmember(key, count = nil) srandmember, srem(key, *values)
srem(key, values : Array(RedisValue))
, sscan(key, cursor, match = nil, count = nil) sscan, strlen(key) strlen, subscribe(*channels : String)
subscribe(*channels, &callback_setup_block : Subscription -> )
subscribe(channels : Array(String)) : Void
, sunion(*keys : String)
sunion(keys : Array(String))
, sunionstore(destination, keys : Array(String)) : Int64
sunionstore(destination, *keys : String) : Int64
, ttl(key) ttl, type(key) type, unsubscribe(*channels)
unsubscribe(channels : Array(String)) : Nil
, unwatch unwatch, watch(keys : Array(String))
, zadd(key, scores_and_members : Array(RedisValue))
zadd(key, *scores_and_members)
, zcard(key) zcard, zcount(key, min, max) zcount, zincrby(key, increment, member) zincrby, zinterstore(destination, keys : Array, weights = nil, aggregate = nil) zinterstore, zlexcount(key, min, max) zlexcount, zrange(key, start, stop, with_scores = false) zrange, zrangebylex(key, min, max, limit = nil) zrangebylex, zrangebyscore(key, min, max, limit = nil, with_scores = false) zrangebyscore, zrank(key, member) zrank, zrem(key, member) zrem, zremrangebylex(key, min, max) zremrangebylex, zremrangebyrank(key, start, stop) zremrangebyrank, zremrangebyscore(key, start, stop) zremrangebyscore, zrevrange(key, start, stop, with_scores = false) zrevrange, zrevrangebylex(key, min, max, limit = nil) zrevrangebylex, zrevrangebyscore(key, min, max, limit = nil, with_scores = false) zrevrangebyscore, zrevrank(key, member) zrevrank, zscan(key, cursor, match = nil, count = nil) zscan, zscore(key, member) zscore, zunionstore(destination, keys : Array, weights = nil, aggregate = nil) zunionstore

Constructor Detail

def, namespace = "") #

[View source]

Instance Method Detail

def discard #

Aborts the current transaction.


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

[View source]