line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Redis::Jet; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
910227
|
use 5.010001; |
|
14
|
|
|
|
|
181
|
|
4
|
14
|
|
|
14
|
|
78
|
use strict; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
293
|
|
5
|
14
|
|
|
14
|
|
62
|
use warnings; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
409
|
|
6
|
14
|
|
|
14
|
|
8012
|
use POSIX qw(EINTR EAGAIN EWOULDBLOCK :sys_wait_h); |
|
14
|
|
|
|
|
92356
|
|
|
14
|
|
|
|
|
76
|
|
7
|
14
|
|
|
14
|
|
30499
|
use IO::Socket qw(:crlf IPPROTO_TCP TCP_NODELAY); |
|
14
|
|
|
|
|
302901
|
|
|
14
|
|
|
|
|
73
|
|
8
|
14
|
|
|
14
|
|
4472
|
use IO::Socket::INET; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
90
|
|
9
|
14
|
|
|
14
|
|
6385
|
use IO::Socket::UNIX; |
|
14
|
|
|
|
|
31
|
|
|
14
|
|
|
|
|
105
|
|
10
|
14
|
|
|
14
|
|
17806
|
use IO::Select; |
|
14
|
|
|
|
|
23998
|
|
|
14
|
|
|
|
|
710
|
|
11
|
14
|
|
|
14
|
|
7806
|
use Time::HiRes qw/time/; |
|
14
|
|
|
|
|
20492
|
|
|
14
|
|
|
|
|
60
|
|
12
|
14
|
|
|
14
|
|
2256
|
use base qw/Exporter/; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
2580
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
15
|
|
|
|
|
|
|
parse_message parse_message_utf8 |
16
|
|
|
|
|
|
|
/; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = "0.09"; |
19
|
|
|
|
|
|
|
|
20
|
14
|
|
|
14
|
|
108
|
use XSLoader; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
5215
|
|
21
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, $VERSION); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
8
|
|
|
8
|
1
|
16415
|
my $class = shift; |
25
|
8
|
50
|
|
|
|
80
|
my %args = ref $_[0] ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
26
|
8
|
|
|
|
|
131
|
%args = ( |
27
|
|
|
|
|
|
|
server => '127.0.0.1:6379', |
28
|
|
|
|
|
|
|
connect_timeout => 5, |
29
|
|
|
|
|
|
|
io_timeout => 1, |
30
|
|
|
|
|
|
|
utf8 => 0, |
31
|
|
|
|
|
|
|
noreply => 0, |
32
|
|
|
|
|
|
|
reconnect_attempts => 0, |
33
|
|
|
|
|
|
|
reconnect_delay => 0.1, |
34
|
|
|
|
|
|
|
%args, |
35
|
|
|
|
|
|
|
); |
36
|
8
|
|
|
|
|
339
|
$class->_new(\%args); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub set_socket { |
40
|
2
|
|
|
2
|
0
|
6
|
my ($self,$socket) = @_; |
41
|
2
|
|
|
|
|
16
|
$self->get_bucket->{socket} = $socket; |
42
|
2
|
|
|
|
|
11
|
$self->set_fileno(fileno($socket)); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub connect { |
46
|
2
|
|
|
2
|
0
|
85
|
my $self = shift; |
47
|
2
|
|
|
|
|
32
|
my $socket; |
48
|
2
|
50
|
|
|
|
37
|
if ($self->get_server =~ m!/!) { |
49
|
0
|
0
|
|
|
|
0
|
$socket = IO::Socket::UNIX->new( |
50
|
|
|
|
|
|
|
Peer => $self->get_server, |
51
|
|
|
|
|
|
|
Timeout => $self->get_connect_timeout, |
52
|
|
|
|
|
|
|
) or return; |
53
|
|
|
|
|
|
|
} else { |
54
|
2
|
50
|
|
|
|
72
|
$socket = IO::Socket::INET->new( |
55
|
|
|
|
|
|
|
PeerAddr => $self->get_server, |
56
|
|
|
|
|
|
|
Timeout => $self->get_connect_timeout, |
57
|
|
|
|
|
|
|
) or return; |
58
|
2
|
50
|
|
|
|
2241
|
$socket->setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) |
59
|
|
|
|
|
|
|
or die "setsockopt(TCP_NODELAY) failed:$!"; |
60
|
|
|
|
|
|
|
} |
61
|
2
|
50
|
|
|
|
38
|
$socket->blocking(0) or die $!; |
62
|
2
|
|
|
|
|
35
|
$self->set_socket($socket); |
63
|
2
|
|
|
|
|
695
|
$socket; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub DESTROY { |
67
|
2
|
|
|
2
|
|
8419
|
$_[0]->_destroy(); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |