The following documentation is automatically generated. Please do not edit this file, but rather the original, inline with Net::Async::Redis::Cluster at lib/Net/Async/Redis/Cluster.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.

NAME

Net::Async::Redis::Cluster - support for cluster routing

SYNOPSIS

 use IO::Async::Loop;
 use Net::Async::Redis::Cluster;
 my $loop = IO::Async::Loop->new;
 $loop->add(
  my $cluster = Net::Async::Redis::Cluster->new(
  )
 );
 await $cluster->bootstrap(
  host => 'redis.local',
 );
 print "Key: " . await $cluster->get('some_key');

DESCRIPTION

Provides access to a Redis cluster.

Usage is similar to Net::Async::Redis with the addition of a "bootstrap" step to find the initial client nodes:

 $loop->add(
  my $cluster = Net::Async::Redis::Cluster->new(
  )
 );
 await $cluster->bootstrap(
  host => 'redis.local',
 );
 print "Key: " . await $cluster->get('some_key');

Note that this adds some overhead to lookups, so you may be better served by options such as the https://github.com/twitter/twemproxy|twemproxy proxy routing dæmon, or a service mesh such as https://istio.io/|istio.

METHODS

bootstrap

Connects to a Redis server and attempts to discover the cluster node configuration.

Usage:

 try {
  await $cluster->bootstrap(
   host => 'redis-primary.local',
   port => 6379,
  );
 } catch {
  $log->errorf('Unable to bootstrap the Redis cluster: %s', $@);
 }

hash_slot_for_key

Calculates the CRC16 hash slot for the given key.

Note that keys are expected as bytestrings, if you have a Unicode string you'd likely want to convert to UTF-8 first.

replace_nodes

Swap the existing node configuration out for a new arrayref of nodes.

node_list

Returns a list of the currently-configured nodes.

node_for_slot

Returns the appropriate Net::Async::Redis::Cluster::Node for the given hash key (slot).

INHERITED METHODS

Net::Async::Redis::Commands

acl_cat, acl_deluser, acl_genpass, acl_getuser, acl_help, acl_list, acl_load, acl_log, acl_save, acl_setuser, acl_users, acl_whoami, append, auth, bgrewriteaof, bgsave, bitcount, bitfield, bitop, bitpos, blpop, brpop, brpoplpush, bzpopmax, bzpopmin, client_caching, client_getname, client_getredir, client_id, client_kill, client_list, client_pause, client_reply, client_setname, client_tracking, client_unblock, cluster_addslots, cluster_bumpepoch, cluster_count_failure_reports, cluster_countkeysinslot, cluster_delslots, cluster_failover, cluster_flushslots, cluster_forget, cluster_getkeysinslot, cluster_info, cluster_keyslot, cluster_meet, cluster_myid, cluster_nodes, cluster_replicas, cluster_replicate, cluster_reset, cluster_saveconfig, cluster_set_config_epoch, cluster_setslot, cluster_slaves, cluster_slots, command, command_count, command_getkeys, command_info, config_get, config_resetstat, config_rewrite, config_set, dbsize, debug_object, debug_segfault, decr, decrby, del, discard, dump, echo, eval, evalsha, exec, exists, expire, expireat, flushall, flushdb, geoadd, geodist, geohash, geopos, georadius, georadiusbymember, get, getbit, getrange, getset, hdel, hello, hexists, hget, hgetall, hincrby, hincrbyfloat, hkeys, hlen, hmget, hmset, hscan, hset, hsetnx, hstrlen, hvals, incr, incrby, incrbyfloat, info, keys, lastsave, latency_doctor, latency_graph, latency_help, latency_history, latency_latest, latency_reset, lindex, linsert, llen, lolwut, lpop, lpush, lpushx, lrange, lrem, lset, ltrim, memory_doctor, memory_help, memory_malloc_stats, memory_purge, memory_stats, memory_usage, mget, migrate, module_list, module_load, module_unload, monitor, move, mset, msetnx, multi, object, persist, pexpire, pexpireat, pfadd, pfcount, pfmerge, ping, psetex, psubscribe, psync, pttl, publish, pubsub, punsubscribe, quit, randomkey, readonly, readwrite, rename, renamenx, replicaof, restore, role, rpop, rpoplpush, rpush, rpushx, sadd, save, scan, scard, script_debug, script_exists, script_flush, script_kill, script_load, sdiff, sdiffstore, select, set, setbit, setex, setnx, setrange, shutdown, sinter, sinterstore, sismember, slaveof, slowlog, smembers, smove, sort, spop, srandmember, srem, sscan, stralgo, strlen, subscribe, sunion, sunionstore, swapdb, sync, time, touch, ttl, type, unlink, unsubscribe, unwatch, wait, watch, xack, xadd, xclaim, xdel, xgroup, xinfo, xlen, xpending, xrange, xread, xreadgroup, xrevrange, xtrim, zadd, zcard, zcount, zincrby, zinterstore, zlexcount, zpopmax, zpopmin, zrange, zrangebylex, zrangebyscore, zrank, zrem, zremrangebylex, zremrangebyrank, zremrangebyscore, zrevrange, zrevrangebylex, zrevrangebyscore, zrevrank, zscan, zscore, zunionstore

IO::Async::Notifier

add_child, adopt_future, adopted_futures, can_event, children, configure, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent

AUTHOR

Tom Molesworth <TEAM@cpan.org> plus contributors as mentioned in "CONTRIBUTORS" in Net::Async::Redis.

LICENSE

Copyright Tom Molesworth and others 2015-2020. Licensed under the same terms as Perl itself.