NAME

MooseX::ConsistentHash::SetConsistentHash - moose version Set::ConsistentHash for MooseX::ConsistentHash Version 0.01

SYNOPSIS

for example

use Digest::JHash qw();
use MooseX::ConsistentHash;
my $hashing = MooseX::ConsistentHash->new(
    class => 'MooseX::ConsistentHash::SetConsistentHash', 
    init_hash => {hash_func => \&Digest::JHash::jhash}
);
$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(
    class => 'MooseX::ConsistentHash::SetConsistentHash'
);
$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::SetConsistentHash used as hash_func Digest::MD5::md5_hex

PROBLEMS

MooseX::ConsistentHash with MooseX::ConsistentHash::SetConsistentHash slower by 80% than the module Set::ConsistentHash

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 Set::ConsistentHash.