line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Redis::ConnectionManager; |
2
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
808
|
use Scalar::Util qw/ weaken /; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
78
|
|
4
|
1
|
|
|
1
|
|
7
|
use Redis; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
6
|
use AnyEvent; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
6
|
1
|
|
|
1
|
|
6
|
use namespace::clean -except => 'meta'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw/ |
9
|
|
|
|
|
|
|
Message::Passing::Role::ConnectionManager |
10
|
|
|
|
|
|
|
Message::Passing::Role::HasHostnameAndPort |
11
|
|
|
|
|
|
|
/; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
|
|
sub _default_port { 6379 } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _build_connection { |
16
|
0
|
|
|
0
|
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
weaken($self); |
18
|
0
|
|
|
|
|
|
my $client = Redis->new( |
19
|
|
|
|
|
|
|
encoding => undef, |
20
|
|
|
|
|
|
|
server => sprintf("%s:%s", $self->hostname, $self->port), |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
# Delay calling set_connected till we've finished building the client |
23
|
0
|
|
|
|
|
|
my $i; $i = AnyEvent->idle(cb => sub { |
24
|
0
|
|
|
0
|
|
|
undef $i; $self->_set_connected(1); |
|
0
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
}); |
26
|
0
|
|
|
|
|
|
return $client; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|