++ed by:
KEEDI DBOOK BEROV PLICEASE

4 PAUSE users
8 non-PAUSE users.

Dan Book
and 1 contributors

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, bitcount, bitop, bitpos, decr, decrby, del, echo, eval, evalsha, exists, expire, expireat, geoadd, geodist, geohash, geopos, georadius, georadiusbymember, get, getbit, getrange, getset, hdel, hexists, hget, hgetall, hincrby, hincrbyfloat, hkeys, hlen, hmget, hmset, hset, hsetnx, hstrlen, hvals, incr, incrby, incrbyfloat, keys, lindex, linsert, llen, lpop, lpush, lpushx, lrange, lrem, lset, ltrim, mget, move, mset, msetnx, persist, pexpire, pexpireat, pfadd, pfcount, pfmerge, ping, psetex, pttl, 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, zlexcount, zrange, zrangebylex, zrangebyscore, zrem, zremrangebylex, zremrangebyrank, zremrangebyscore, zrank, zrevrange, zrevrangebylex, zrevrangebyscore, zrevrank, zscore, 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