DBIx::DBHResolver::Strategy::Range - Range based strategy
use DBIx::DBHResolver;
use DBIx::DBHResolver::Strategy::Range;
my $day = 24 * 60 * 60;
my $resolver = DBIx::DBHResolver->new;
$resolver->config(+{
clusters => +{
TIMELINE => +{
nodes => [qw/TIMELINE_ARCHIVE TIMELINE_YEAR TIMELINE_LATEST/],
strategy => 'Range',
strategy_config => [
TIMELINE_ARCHIVE => [ '>' => 365 ],
TIMELINE_THIS_YEAR => [ '>' => 30, '<=' => 365 ],
TIMELINE_LATEST => [ '>=' => 0, '<=' => 30 ],
],
}
},
connect_info => +{
TIMELINE_ARCHIVE => +{ ... },
TIMELINE_THIS_YEAR => +{ ... },
TIMELINE_LATEST => +{ ... },
}
});
my $strategy = 'DBIx::DBHResolver::Strategy::List';
$strategy->connect_info( $resolver, 'TIMELINE', 380 ); # return TIMELINE_ARCHIVE's connect_info
$strategy->connect_info( $resolver, 'TIMELINE', 55 ); # return TIMELINE_YEAR's connect_info
$strategy->connect_info( $resolver, 'TIMELINE', 0 ); # return TIMELINE_LATEST's connect_info
This module is range based sharding strategy. Supported operator are '>',
'>=' '<', '<='.
Return connect_info hash ref.
Return resolved node_or_cluster name.
Toru Yamaguchi <zigorou@dena.jp<gt>
This module is licensed under the same terms as Perl itself.