The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::ConsistentHash::AlgorithmConsistentHashKetama - moose version Algorithm::ConsistentHash::Ketama for MooseX::ConsistentHash Version 0.01

SYNOPSIS

for example

    use MooseX::ConsistentHash;
    my $hashing = MooseX::ConsistentHash->new(
        class => 'MooseX::ConsistentHash::AlgorithmConsistentHashKetama'
    );
    $hashing->add_options(
        {option => 'foo1', weight => 1},
        {option => 'foo2', weight => 2}
    );
    my $some = Some->new();
    $hashing->add_option(option => $some, weight => 10);
    my $result_option = $hashing->get_option('some_string');
    # $result_option may be 'foo1' or 'foo2' or $some  

MORE EXAMPLE

another example

    use MooseX::ConsistentHash;
    my $hashing = MooseX::ConsistentHash->new();
    $hashing->add_options(
        {option => 'foo1', weight => 1},
        {option => 'foo2', weight => 2}
    );
    my $some = Some->new();
    $hashing->add_option(option => $some, weight => 10);
    my $result_option = $hashing->get_option('some_string');
    # $result_option may be 'foo1' or 'foo2' or $some 

By default, MooseX::ConsistentHash used as 'class' MooseX::ConsistentHash::AlgorithmConsistentHashKetama.

PROBLEMS

MooseX::ConsistentHash with MooseX::ConsistentHash::AlgorithmConsistentHashKetama slower by 80% than the module Algorithm::ConsistentHash::Ketama

SEE ALSO

AUTHOR

Sivirinov Ivan, <catamoose at yandex.ru>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10 or, at your option, any later version of Perl 5 you may have available.

And see Algorithm::ConsistentHash::Ketama.