=for comment POD_DERIVED_INDEX_GENERATED
The following documentation is automatically generated.  Please do not edit
this file, but rather the original, inline with Net::Async::Redis
at lib/Net/Async/Redis.pm
(on the system that originally ran this).
If you do edit this file, and don't want your changes to be removed, make
sure you change the first line.

=cut

=head1 NAME

Net::Async::Redis - talk to Redis servers via L<IO::Async>

=head1 SYNOPSIS

    use Net::Async::Redis;
    use IO::Async::Loop;
    my $loop = IO::Async::Loop->new;
    $loop->add(my $redis = Net::Async::Redis->new);
    $redis->connect->then(sub {
        $redis->get('some_key')
    })->then(sub {
        my $value = shift;
        return Future->done($value) if $value;
        $redis->set(some_key => 'some_value')
    })->on_done(sub {
        print "Value: " . shift;
    })->get;

    # ... or with Future::AsyncAwait
    await $redis->connect;
    my $value = await $redis->get('some_key');
    $value ||= await $redis->set(some_key => 'some_value');
    print "Value: $value";

=head1 DESCRIPTION

See L<Net::Async::Redis::Commands> for the full list of commands.

=head1 METHODS

B<NOTE>: For a full list of the Redis methods supported by this module,
please see L<Net::Async::Redis::Commands>.

=head1 METHODS - Subscriptions

See L<https://redis.io/topics/pubsub> for more details on this topic.
There's also more details on the internal implementation in Redis here:
L<https://making.pusher.com/redis-pubsub-under-the-hood/>.

=head2 psubscribe

Subscribes to a pattern.

=head2 subscribe

Subscribes to one or more channels.

Resolves to a L<Net::Async::Redis::Subscription> instance.

Example:

 # Subscribe to 'notifications' channel,
 # print the first 5 messages, then unsubscribe
 $redis->subscribe('notifications')
    ->then(sub {
        my $sub = shift;
        $sub->map('payload')
            ->take(5)
            ->say
            ->completion
    })->then(sub {
        $redis->unsubscribe('notifications')
    })->get

=head1 METHODS - Transactions

=head2 multi

Executes the given code in a Redis C<MULTI> transaction.

This will cause each of the requests to be queued, then executed in a single atomic transaction.

Example:

 $redis->multi(sub {
  my $tx = shift;
  $tx->incr('some::key')->on_done(sub { print "Final value for incremented key was " . shift . "\n"; });
  $tx->set('other::key => 'test data')
 })->then(sub {
  my ($success, $failure) = @_;
  return Future->fail("Had $failure failures, expecting everything to succeed") if $failure;
  print "$success succeeded\m";
  return Future->done;
 })->retain;

=head1 METHODS - Generic

=head2 keys

=head2 watch_keyspace

=head2 connect

=head2 on_message

Called for each incoming message.

Passes off the work to L</handle_pubsub_message> or the next queue
item, depending on whether we're dealing with subscriptions at the moment.

=head2 stream

Represents the L<IO::Async::Stream> instance for the active Redis connection.

=head2 pipeline_depth

Number of requests awaiting responses before we start queuing.
This defaults to an arbitrary value of 100 requests.

Note that this does not apply when in L<transaction|METHODS - Transactions> (C<MULTI>) mode.

See L<https://redis.io/topics/pipelining> for more details on this concept.

=head1 METHODS - Deprecated

This are still supported, but no longer recommended.

=head1 METHODS - Internal

=head1 SEE ALSO

Some other Redis implementations on CPAN:

=over 4

=item * L<Mojo::Redis2> - nonblocking, using the L<Mojolicious> framework, actively maintained

=item * L<MojoX::Redis>

=item * L<RedisDB>

=item * L<Cache::Redis>

=item * L<Redis::Fast>

=item * L<Redis::Jet>

=back

=head1 INHERITED METHODS

=over 4

=item L<Net::Async::Redis::Commands>

L<append|Net::Async::Redis::Commands/append>, L<bgrewriteaof|Net::Async::Redis::Commands/bgrewriteaof>, L<bgsave|Net::Async::Redis::Commands/bgsave>, L<bitcount|Net::Async::Redis::Commands/bitcount>, L<bitfield|Net::Async::Redis::Commands/bitfield>, L<bitop|Net::Async::Redis::Commands/bitop>, L<bitpos|Net::Async::Redis::Commands/bitpos>, L<blpop|Net::Async::Redis::Commands/blpop>, L<brpop|Net::Async::Redis::Commands/brpop>, L<brpoplpush|Net::Async::Redis::Commands/brpoplpush>, L<client_getname|Net::Async::Redis::Commands/client_getname>, L<client_kill|Net::Async::Redis::Commands/client_kill>, L<client_list|Net::Async::Redis::Commands/client_list>, L<client_pause|Net::Async::Redis::Commands/client_pause>, L<client_reply|Net::Async::Redis::Commands/client_reply>, L<client_setname|Net::Async::Redis::Commands/client_setname>, L<cluster_addslots|Net::Async::Redis::Commands/cluster_addslots>, L<cluster_count_failure_reports|Net::Async::Redis::Commands/cluster_count_failure_reports>, L<cluster_countkeysinslot|Net::Async::Redis::Commands/cluster_countkeysinslot>, L<cluster_delslots|Net::Async::Redis::Commands/cluster_delslots>, L<cluster_failover|Net::Async::Redis::Commands/cluster_failover>, L<cluster_forget|Net::Async::Redis::Commands/cluster_forget>, L<cluster_getkeysinslot|Net::Async::Redis::Commands/cluster_getkeysinslot>, L<cluster_info|Net::Async::Redis::Commands/cluster_info>, L<cluster_keyslot|Net::Async::Redis::Commands/cluster_keyslot>, L<cluster_meet|Net::Async::Redis::Commands/cluster_meet>, L<cluster_nodes|Net::Async::Redis::Commands/cluster_nodes>, L<cluster_replicate|Net::Async::Redis::Commands/cluster_replicate>, L<cluster_reset|Net::Async::Redis::Commands/cluster_reset>, L<cluster_saveconfig|Net::Async::Redis::Commands/cluster_saveconfig>, L<cluster_set_config_epoch|Net::Async::Redis::Commands/cluster_set_config_epoch>, L<cluster_setslot|Net::Async::Redis::Commands/cluster_setslot>, L<cluster_slaves|Net::Async::Redis::Commands/cluster_slaves>, L<cluster_slots|Net::Async::Redis::Commands/cluster_slots>, L<command|Net::Async::Redis::Commands/command>, L<command_count|Net::Async::Redis::Commands/command_count>, L<command_getkeys|Net::Async::Redis::Commands/command_getkeys>, L<command_info|Net::Async::Redis::Commands/command_info>, L<config_get|Net::Async::Redis::Commands/config_get>, L<config_resetstat|Net::Async::Redis::Commands/config_resetstat>, L<config_rewrite|Net::Async::Redis::Commands/config_rewrite>, L<config_set|Net::Async::Redis::Commands/config_set>, L<dbsize|Net::Async::Redis::Commands/dbsize>, L<debug_object|Net::Async::Redis::Commands/debug_object>, L<debug_segfault|Net::Async::Redis::Commands/debug_segfault>, L<decr|Net::Async::Redis::Commands/decr>, L<decrby|Net::Async::Redis::Commands/decrby>, L<del|Net::Async::Redis::Commands/del>, L<dump|Net::Async::Redis::Commands/dump>, L<echo|Net::Async::Redis::Commands/echo>, L<eval|Net::Async::Redis::Commands/eval>, L<evalsha|Net::Async::Redis::Commands/evalsha>, L<exists|Net::Async::Redis::Commands/exists>, L<expire|Net::Async::Redis::Commands/expire>, L<expireat|Net::Async::Redis::Commands/expireat>, L<flushall|Net::Async::Redis::Commands/flushall>, L<flushdb|Net::Async::Redis::Commands/flushdb>, L<geoadd|Net::Async::Redis::Commands/geoadd>, L<geodist|Net::Async::Redis::Commands/geodist>, L<geohash|Net::Async::Redis::Commands/geohash>, L<geopos|Net::Async::Redis::Commands/geopos>, L<georadius|Net::Async::Redis::Commands/georadius>, L<georadiusbymember|Net::Async::Redis::Commands/georadiusbymember>, L<get|Net::Async::Redis::Commands/get>, L<getbit|Net::Async::Redis::Commands/getbit>, L<getrange|Net::Async::Redis::Commands/getrange>, L<getset|Net::Async::Redis::Commands/getset>, L<hdel|Net::Async::Redis::Commands/hdel>, L<hexists|Net::Async::Redis::Commands/hexists>, L<hget|Net::Async::Redis::Commands/hget>, L<hgetall|Net::Async::Redis::Commands/hgetall>, L<hincrby|Net::Async::Redis::Commands/hincrby>, L<hincrbyfloat|Net::Async::Redis::Commands/hincrbyfloat>, L<hkeys|Net::Async::Redis::Commands/hkeys>, L<hlen|Net::Async::Redis::Commands/hlen>, L<hmget|Net::Async::Redis::Commands/hmget>, L<hmset|Net::Async::Redis::Commands/hmset>, L<hscan|Net::Async::Redis::Commands/hscan>, L<hset|Net::Async::Redis::Commands/hset>, L<hsetnx|Net::Async::Redis::Commands/hsetnx>, L<hstrlen|Net::Async::Redis::Commands/hstrlen>, L<hvals|Net::Async::Redis::Commands/hvals>, L<incr|Net::Async::Redis::Commands/incr>, L<incrby|Net::Async::Redis::Commands/incrby>, L<incrbyfloat|Net::Async::Redis::Commands/incrbyfloat>, L<info|Net::Async::Redis::Commands/info>, L<lastsave|Net::Async::Redis::Commands/lastsave>, L<lindex|Net::Async::Redis::Commands/lindex>, L<linsert|Net::Async::Redis::Commands/linsert>, L<llen|Net::Async::Redis::Commands/llen>, L<lpop|Net::Async::Redis::Commands/lpop>, L<lpush|Net::Async::Redis::Commands/lpush>, L<lpushx|Net::Async::Redis::Commands/lpushx>, L<lrange|Net::Async::Redis::Commands/lrange>, L<lrem|Net::Async::Redis::Commands/lrem>, L<lset|Net::Async::Redis::Commands/lset>, L<ltrim|Net::Async::Redis::Commands/ltrim>, L<mget|Net::Async::Redis::Commands/mget>, L<migrate|Net::Async::Redis::Commands/migrate>, L<monitor|Net::Async::Redis::Commands/monitor>, L<move|Net::Async::Redis::Commands/move>, L<mset|Net::Async::Redis::Commands/mset>, L<msetnx|Net::Async::Redis::Commands/msetnx>, L<object|Net::Async::Redis::Commands/object>, L<persist|Net::Async::Redis::Commands/persist>, L<pexpire|Net::Async::Redis::Commands/pexpire>, L<pexpireat|Net::Async::Redis::Commands/pexpireat>, L<pfadd|Net::Async::Redis::Commands/pfadd>, L<pfcount|Net::Async::Redis::Commands/pfcount>, L<pfmerge|Net::Async::Redis::Commands/pfmerge>, L<ping|Net::Async::Redis::Commands/ping>, L<psetex|Net::Async::Redis::Commands/psetex>, L<pttl|Net::Async::Redis::Commands/pttl>, L<publish|Net::Async::Redis::Commands/publish>, L<pubsub|Net::Async::Redis::Commands/pubsub>, L<punsubscribe|Net::Async::Redis::Commands/punsubscribe>, L<quit|Net::Async::Redis::Commands/quit>, L<randomkey|Net::Async::Redis::Commands/randomkey>, L<readonly|Net::Async::Redis::Commands/readonly>, L<readwrite|Net::Async::Redis::Commands/readwrite>, L<rename|Net::Async::Redis::Commands/rename>, L<renamenx|Net::Async::Redis::Commands/renamenx>, L<restore|Net::Async::Redis::Commands/restore>, L<role|Net::Async::Redis::Commands/role>, L<rpop|Net::Async::Redis::Commands/rpop>, L<rpoplpush|Net::Async::Redis::Commands/rpoplpush>, L<rpush|Net::Async::Redis::Commands/rpush>, L<rpushx|Net::Async::Redis::Commands/rpushx>, L<sadd|Net::Async::Redis::Commands/sadd>, L<save|Net::Async::Redis::Commands/save>, L<scan|Net::Async::Redis::Commands/scan>, L<scard|Net::Async::Redis::Commands/scard>, L<script_debug|Net::Async::Redis::Commands/script_debug>, L<script_exists|Net::Async::Redis::Commands/script_exists>, L<script_flush|Net::Async::Redis::Commands/script_flush>, L<script_kill|Net::Async::Redis::Commands/script_kill>, L<script_load|Net::Async::Redis::Commands/script_load>, L<sdiff|Net::Async::Redis::Commands/sdiff>, L<sdiffstore|Net::Async::Redis::Commands/sdiffstore>, L<select|Net::Async::Redis::Commands/select>, L<set|Net::Async::Redis::Commands/set>, L<setbit|Net::Async::Redis::Commands/setbit>, L<setex|Net::Async::Redis::Commands/setex>, L<setnx|Net::Async::Redis::Commands/setnx>, L<setrange|Net::Async::Redis::Commands/setrange>, L<shutdown|Net::Async::Redis::Commands/shutdown>, L<sinter|Net::Async::Redis::Commands/sinter>, L<sinterstore|Net::Async::Redis::Commands/sinterstore>, L<sismember|Net::Async::Redis::Commands/sismember>, L<slaveof|Net::Async::Redis::Commands/slaveof>, L<slowlog|Net::Async::Redis::Commands/slowlog>, L<smembers|Net::Async::Redis::Commands/smembers>, L<smove|Net::Async::Redis::Commands/smove>, L<sort|Net::Async::Redis::Commands/sort>, L<spop|Net::Async::Redis::Commands/spop>, L<srandmember|Net::Async::Redis::Commands/srandmember>, L<srem|Net::Async::Redis::Commands/srem>, L<sscan|Net::Async::Redis::Commands/sscan>, L<strlen|Net::Async::Redis::Commands/strlen>, L<sunion|Net::Async::Redis::Commands/sunion>, L<sunionstore|Net::Async::Redis::Commands/sunionstore>, L<swapdb|Net::Async::Redis::Commands/swapdb>, L<sync|Net::Async::Redis::Commands/sync>, L<time|Net::Async::Redis::Commands/time>, L<touch|Net::Async::Redis::Commands/touch>, L<ttl|Net::Async::Redis::Commands/ttl>, L<type|Net::Async::Redis::Commands/type>, L<unlink|Net::Async::Redis::Commands/unlink>, L<unsubscribe|Net::Async::Redis::Commands/unsubscribe>, L<unwatch|Net::Async::Redis::Commands/unwatch>, L<wait|Net::Async::Redis::Commands/wait>, L<watch|Net::Async::Redis::Commands/watch>, L<zadd|Net::Async::Redis::Commands/zadd>, L<zcard|Net::Async::Redis::Commands/zcard>, L<zcount|Net::Async::Redis::Commands/zcount>, L<zincrby|Net::Async::Redis::Commands/zincrby>, L<zinterstore|Net::Async::Redis::Commands/zinterstore>, L<zlexcount|Net::Async::Redis::Commands/zlexcount>, L<zrange|Net::Async::Redis::Commands/zrange>, L<zrangebylex|Net::Async::Redis::Commands/zrangebylex>, L<zrangebyscore|Net::Async::Redis::Commands/zrangebyscore>, L<zrank|Net::Async::Redis::Commands/zrank>, L<zrem|Net::Async::Redis::Commands/zrem>, L<zremrangebylex|Net::Async::Redis::Commands/zremrangebylex>, L<zremrangebyrank|Net::Async::Redis::Commands/zremrangebyrank>, L<zremrangebyscore|Net::Async::Redis::Commands/zremrangebyscore>, L<zrevrange|Net::Async::Redis::Commands/zrevrange>, L<zrevrangebylex|Net::Async::Redis::Commands/zrevrangebylex>, L<zrevrangebyscore|Net::Async::Redis::Commands/zrevrangebyscore>, L<zrevrank|Net::Async::Redis::Commands/zrevrank>, L<zscan|Net::Async::Redis::Commands/zscan>, L<zscore|Net::Async::Redis::Commands/zscore>, L<zunionstore|Net::Async::Redis::Commands/zunionstore>

=item L<IO::Async::Notifier>

L<add_child|IO::Async::Notifier/add_child>, L<adopt_future|IO::Async::Notifier/adopt_future>, L<can_event|IO::Async::Notifier/can_event>, L<children|IO::Async::Notifier/children>, L<configure_unknown|IO::Async::Notifier/configure_unknown>, L<debug_printf|IO::Async::Notifier/debug_printf>, L<get_loop|IO::Async::Notifier/get_loop>, L<invoke_error|IO::Async::Notifier/invoke_error>, L<invoke_event|IO::Async::Notifier/invoke_event>, L<loop|IO::Async::Notifier/loop>, L<make_event_cb|IO::Async::Notifier/make_event_cb>, L<maybe_invoke_event|IO::Async::Notifier/maybe_invoke_event>, L<maybe_make_event_cb|IO::Async::Notifier/maybe_make_event_cb>, L<new|IO::Async::Notifier/new>, L<notifier_name|IO::Async::Notifier/notifier_name>, L<parent|IO::Async::Notifier/parent>, L<remove_child|IO::Async::Notifier/remove_child>, L<remove_from_parent|IO::Async::Notifier/remove_from_parent>

=back

=head1 AUTHOR

Tom Molesworth <TEAM@cpan.org>

=head1 LICENSE

Copyright Tom Molesworth 2015-2017. Licensed under the same terms as Perl itself.

