NAME
Async::Redis::Transaction - Transaction command collector
SYNOPSIS
my $results = await $redis->multi(async sub {
my ($tx) = @_;
$tx->set('key', 'value');
$tx->incr('counter');
});
my $watched = await $redis->watch_multi(['counter'], async sub {
my ($tx, $values) = @_;
$tx->set('counter', $values->{counter} + 1);
});
DESCRIPTION
This class collects commands during a transaction callback. Commands are queued locally and then sent as MULTI/commands.../EXEC.
Transaction command calls do not return per-command Futures. Redis returns their actual results from EXEC, in the same order the commands were queued.
METHODS
command
$tx->command('SET', 'key', 'value');
Queue an explicit command.
AUTOLOAD
Any Redis command can be called directly and is queued by name:
$tx->set('key', 'value');
$tx->hset('hash', 'field', 'value');
commands
my @commands = $tx->commands;
Return queued commands as arrayrefs. This is used internally by Async::Redis.