class Redis::TransactionApi
- Redis::TransactionApi
- Reference
- Object
Overview
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.
Included Modules
- Redis::CommandExecution::FutureOriented
- Redis::Commands
Defined in:
redis/transaction_api.crConstructors
Instance Method Summary
-
#discard
Aborts the current transaction.
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_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)
bitop,
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)del(*keys) del, 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, 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) hmget, 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 = nil) info, keys(pattern) keys, lindex(key, index) lindex, linsert(key, where, pivot, value) linsert, llen(key) llen, lpop(key) lpop, lpush(key, values : Array(RedisValue))
lpush(key, *values) lpush, 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)
mget(*keys) mget, 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) pfadd, pfcount(*keys) pfcount, pfmerge(*keys) pfmerge, ping ping, psetex(key, expire_in_milis, value) psetex, psubscribe(*channel_patterns, &callback_setup_block : Subscription -> )
psubscribe(*channel_patterns) psubscribe, pttl(key) pttl, publish(channel, message) publish, punsubscribe(*channel_patterns) punsubscribe, 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) rpush, rpushx(key, value) rpushx, sadd(key, values : Array(RedisValue))
sadd(key, *values) sadd, 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) sdiff, sdiffstore(destination, *keys) sdiffstore, 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) sinter, sinterstore(destination_key, *keys) sinterstore, sismember(key, value) sismember, smembers(key) smembers, smove(source, destination, member) smove, sort(key, by = nil, limit = nil, get : Array(RedisValue) | Nil = nil, order = "ASC", alpha = false, store = nil) sort, spop(key, count = nil) spop, srandmember(key, count = nil) srandmember, srem(key, values : Array(RedisValue))
srem(key, *values) srem, sscan(key, cursor, match = nil, count = nil) sscan, strlen(key) strlen, subscribe(*channels, &callback_setup_block : Subscription -> )
subscribe(*channels) subscribe, sunion(*keys) sunion, sunionstore(destination, *keys) sunionstore, ttl(key) ttl, type(key) type, unsubscribe(*channels) unsubscribe, unwatch unwatch, watch(*keys) watch, zadd(key, scores_and_members : Array(RedisValue))
zadd(key, *scores_and_members) zadd, 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
Instance Method Detail
def discard
#
Aborts the current transaction.
Example:
redis.multi do |multi|
multi.set("foo", "the new value")
multi.discard
end