AnyEvent-RipeRedis-Cluster

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

# CONSTRUCTOR

## new( %params )

    my $cluster = AnyEvent::RipeRedis::Cluster->new(
      startup_nodes => [
        { host => 'localhost', port => 7000 },
        { host => 'localhost', port => 7001 },
        { host => 'localhost', port => 7002 },
      ],
      password           => 'yourpass',
      connection_timeout => 5,
      read_timeout       => 5,
      refresh_interval   => 5,
      lazy               => 1,
      reconnect_interval => 5,

      on_node_connect => sub {
        my $host = shift;
        my $port = shift;

README.md  view on Meta::CPAN


- startup\_nodes => \\@nodes

    Specifies the list of startup nodes. Parameter should contain the array of
    hashes that contains addresses of some nodes in the cluster. Each hash should
    contain `host` and `port` elements. The client will try to connect to random
    node from the list to retrieve information about all cluster nodes and slots
    mapping. If the client could not connect to first selected node, it will try
    to connect to another random node from the list.

- password => $password

    If the password is specified, the `AUTH` command is sent to all nodes
    of the cluster after connection.

- allow\_slaves => $boolean

    If enabled, the client will try to send read-only commands to slave nodes.

    Disabled by default.

- utf8 => $boolean

lib/AnyEvent/RipeRedis/Cluster.pm  view on Meta::CPAN

  $self->{allow_slaves}  = $params{allow_slaves};
  $self->{lazy}          = $params{lazy};
  $self->refresh_interval( $params{refresh_interval} );

  $self->{on_node_connect}    = $params{on_node_connect};
  $self->{on_node_disconnect} = $params{on_node_disconnect};
  $self->{on_node_error}      = $params{on_node_error};
  $self->on_error( $params{on_error} );

  my %node_params;
  foreach my $name ( qw( password utf8 connection_timeout read_timeout
      reconnect reconnect_interval handle_params ) )
  {
    next unless defined $params{$name};
    $node_params{$name} = $params{$name};
  }
  $self->{_node_params} = \%node_params;

  $self->_reset_internals;
  $self->{_input_queue} = [];
  $self->{_temp_queue}  = [];

lib/AnyEvent/RipeRedis/Cluster.pm  view on Meta::CPAN

=head1 CONSTRUCTOR

=head2 new( %params )

  my $cluster = AnyEvent::RipeRedis::Cluster->new(
    startup_nodes => [
      { host => 'localhost', port => 7000 },
      { host => 'localhost', port => 7001 },
      { host => 'localhost', port => 7002 },
    ],
    password           => 'yourpass',
    connection_timeout => 5,
    read_timeout       => 5,
    refresh_interval   => 5,
    lazy               => 1,
    reconnect_interval => 5,

    on_node_connect => sub {
      my $host = shift;
      my $port = shift;

lib/AnyEvent/RipeRedis/Cluster.pm  view on Meta::CPAN


=item startup_nodes => \@nodes

Specifies the list of startup nodes. Parameter should contain the array of
hashes that contains addresses of some nodes in the cluster. Each hash should
contain C<host> and C<port> elements. The client will try to connect to random
node from the list to retrieve information about all cluster nodes and slots
mapping. If the client could not connect to first selected node, it will try
to connect to another random node from the list.

=item password => $password

If the password is specified, the C<AUTH> command is sent to all nodes
of the cluster after connection.

=item allow_slaves => $boolean

If enabled, the client will try to send read-only commands to slave nodes.

Disabled by default.

=item utf8 => $boolean



( run in 0.478 second using v1.01-cache-2.11-cpan-49f99fa48dc )