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.
To install DBIx::DBHResolver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::DBHResolver
CPAN shell
perl -MCPAN -e shell install DBIx::DBHResolver
For more information on module installation, please visit the detailed CPAN module installation guide.