NAME
DBIx::DBHResolver::Strategy::Key - Key based strategy
SYNOPSIS
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
DESCRIPTION
This module is key based sharding strategy.
METHODS
connect_info( $resolver, $node_or_cluster, $args )
Return connect_info hash ref.
resolve( $resolver, $node_or_cluster, $key, $args )
Return resolved node_or_cluster name.
AUTHOR
Toru Yamaguchi <zigorou@cpan.org<gt>
LICENSE
This module is licensed under the same terms as Perl itself.