NAME

RedisDB::Cluster - client for redis cluster

SYNOPSIS

my $cluster = RedisDB::Cluster->new( startup_nodes => \@nodes );
$cluster->set( 'foo', 'bar' );
my $res = $cluster->get('foo');

DESCRIPTION

This module allows you to access redis cluster.

WARNING: this module is at early stage of development

METHODS

$self->new(startup_nodes => \@nodes)

create a new connection to cluster. Startup nodes are used to retrieve information about all cluster nodes and slots mappings.

$self->execute($command, $key, @args)

sends command to redis and returns the reply. It determines the cluster node to send command to from the $key.

$self->add_new_node($address[, $master_id])

attach node with the specified $address to the cluster. If $master_id is specified, the new node is configured as a replica of the master with the specified ID, otherwise it will be a master node itself. Address should be specified as a hash containing host and port elements.

$self->random_connection

return RedisDB object that is connected to random node of the cluster.

$self->crc16($buf)

compute crc16 for the specified buffer as defined in redis cluster specification

$self->key_slot($key)

return slot number for the given $key

AUTHOR

Pavel Shaydo, <zwon at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2011-2015 Pavel Shaydo.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.