DBIx::DBHResolver::Strategy::Key - Key based strategy
use DBIx::DBHResolver;
use DBIx::DBHResolver::Strategy::Key;
my $resolver = DBIx::DBHResolver->new;
$resolver->config(+{
clusters => +{
MASTER => +{
nodes => [ qw(MASTER1 MASTER2 MASTER3) ],
strategy => 'Key',
},
},
connect_info => +{
MASTER1 => +{ ... },
MASTER2 => +{ ... },
MASTER3 => +{ ... },
},
});
my $strategy = 'DBIx::DBHResolver::Strategy::Key';
$strategy->connect_info( $resolver, 'MASTER', 3 ); # return MASTER1's connect_info
$strategy->connect_info( $resolver, 'MASTER', 4 ); # return MASTER2's connect_info
$strategy->connect_info( $resolver, 'MASTER', 5 ); # return MASTER3's connect_info
This module is key based sharding strategy.
Return connect_info hash ref.
Return resolved node_or_cluster name.
Toru Yamaguchi <zigorou@cpan.org<gt>
This module is licensed under the same terms as Perl itself.