Transaction accumulator for executing multiple FerricStore commands atomically.
Used with FerricStore.multi/1 to batch multiple operations. Commands are
accumulated in reverse order and executed sequentially when the transaction
completes.
Usage
FerricStore.multi(fn tx ->
tx
|> FerricStore.Tx.set("key1", "val1")
|> FerricStore.Tx.get("key1")
end)
Summary
Functions
Adds a DEL command to the transaction.
Executes all accumulated transaction commands atomically.
Adds an EXPIRE command to the transaction.
Adds a GET command to the transaction.
Adds an HGET command to the transaction.
Adds an HSET command to the transaction.
Adds an INCR command to the transaction.
Adds an INCRBY command to the transaction.
Adds an LPUSH command to the transaction.
Creates a new empty transaction.
Adds an RPUSH command to the transaction.
Adds a SADD command to the transaction.
Adds a SET command to the transaction.
Adds a ZADD command to the transaction.
Types
@type command() :: {:set, binary(), binary(), keyword()} | {:get, binary()} | {:del, binary()} | {:incr, binary()} | {:incr_by, binary(), integer()} | {:hset, binary(), map()} | {:hget, binary(), binary()} | {:lpush, binary(), [binary()]} | {:rpush, binary(), [binary()]} | {:sadd, binary(), [binary()]} | {:zadd, binary(), [{number(), binary()}]} | {:expire, binary(), non_neg_integer()}
@type t() :: %FerricStore.Tx{commands: [command()]}
Functions
Adds a DEL command to the transaction.
Executes all accumulated transaction commands atomically.
Groups commands by shard. If all target a single shard, dispatches them as a batch to the shard GenServer (atomic, no interleaving). If commands span multiple shards, returns a CROSSSLOT error.
@spec expire(t(), binary(), non_neg_integer()) :: t()
Adds an EXPIRE command to the transaction.
Adds a GET command to the transaction.
Adds an HGET command to the transaction.
Adds an HSET command to the transaction.
Adds an INCR command to the transaction.
Adds an INCRBY command to the transaction.
Adds an LPUSH command to the transaction.
@spec new() :: t()
Creates a new empty transaction.
Adds an RPUSH command to the transaction.
Adds a SADD command to the transaction.
Adds a SET command to the transaction.
Adds a ZADD command to the transaction.