++ed by:
DBOOK BEROV PLICEASE

3 PAUSE users
7 non-PAUSE users.

Jan Henning Thorsen

NAME

Mojo::Redis2::Bulk - Mojo::Redis2 bulk operations

DESCRIPTION

Mojo::Redis2::Bulk allow many Mojo::Redis2 operations to be grouped into one serialized operation. This can help you avoid crazy many callback arguments.

SYNOPSIS

  use Mojo::Redis2;
  my $redis = Mojo::Redis2->new;
  my $bulk = $redis->bulk;

  $res = $bulk->set(foo => 123)->get("foo")->execute;

  Mojo::IOLoop->delay(
    sub {
      my ($delay) = @_;
      $bulk->set(foo => 123)->get("foo")->execute($delay->begin);
    },
    sub {
      my ($delay, $err, $res) = @_;
      $self->render(json => {
        err => $err->compact->join('. '),
        res => $res,
      });
    },
  );

In both the sync and async examples above, $res will contain on success:

  [
    "OK",
    123,
  ];

$err on the other hand will be a Mojo::Collection object with all one element for each error message.

METHODS

In addition to the methods listed in this module, you can call these Redis methods on $self:

append, echo, decr, decrby, del, exists, expire, expireat, get, getbit, getrange, getset, hdel, hexists, hget, hgetall, hincrby, hkeys, hlen, hmget, hmset, hset, hsetnx, hvals, incr, incrby, keys, lindex, linsert, llen, lpop, lpush, lpushx, lrange, lrem, lset, ltrim, mget, move, mset, msetnx, persist, ping, publish, randomkey, rename, renamenx, rpop, rpoplpush, rpush, rpushx, sadd, scard, sdiff, sdiffstore, set, setbit, setex, setnx, setrange, sinter, sinterstore, sismember, smembers, smove, sort, spop, srandmember, srem, strlen, sunion, sunionstore, ttl, type, zadd, zcard, zcount, zincrby, zinterstore, zrange, zrangebyscore, zrank, zrem, zremrangebyrank, zremrangebyscore, zrevrange, zrevrangebyscore, zrevrank, zscore and zunionstore.

execute

  $res = $self->execute;
  $self = $self->execute(sub { my ($self, $err, $res) = @_; });

Will execute all the queued Redis operations.

COPYRIGHT AND LICENSE

Copyright (C) 2014, Jan Henning Thorsen

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org