line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cache::Memcached::Fast 0.28; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
626487
|
use v5.12; |
|
17
|
|
|
|
|
155
|
|
4
|
17
|
|
|
17
|
|
76
|
use warnings; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
373
|
|
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
79
|
use Carp (); |
|
17
|
|
|
|
|
47
|
|
|
17
|
|
|
|
|
352
|
|
7
|
17
|
|
|
17
|
|
9082
|
use Compress::Zlib (); |
|
17
|
|
|
|
|
1008655
|
|
|
17
|
|
|
|
|
484
|
|
8
|
17
|
|
|
17
|
|
12317
|
use Storable; |
|
17
|
|
|
|
|
50794
|
|
|
17
|
|
|
|
|
1105
|
|
9
|
17
|
|
|
17
|
|
160
|
use XSLoader; |
|
17
|
|
|
|
|
37
|
|
|
17
|
|
|
|
|
7241
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %instance; |
12
|
|
|
|
|
|
|
my %known_args = map { $_ => 1 } qw( |
13
|
|
|
|
|
|
|
check_args close_on_error compress_algo compress_methods compress_ratio |
14
|
|
|
|
|
|
|
compress_threshold connect_timeout failure_timeout hash_namespace |
15
|
|
|
|
|
|
|
io_timeout ketama_points max_failures max_size namespace nowait |
16
|
|
|
|
|
|
|
select_timeout serialize_methods servers utf8 |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
21
|
|
|
21
|
1
|
931504
|
my ( $class, $conf ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
21
|
100
|
100
|
|
|
224
|
unless ( lc( $conf->{check_args} // '' ) eq 'skip' ) { |
23
|
|
|
|
|
|
|
Carp::carp 'compress_algo was removed in 0.08, use compress_methods' |
24
|
20
|
100
|
|
|
|
237
|
if exists $conf->{compress_algo}; |
25
|
|
|
|
|
|
|
|
26
|
20
|
100
|
|
|
|
377
|
if ( my @unknown = grep !$known_args{$_}, sort keys %$conf ) { |
27
|
1
|
|
|
|
|
3
|
local $" = ', '; |
28
|
1
|
|
|
|
|
70
|
Carp::carp "Unknown arguments: @unknown"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Note that the functions below can't return false when operation succeed. |
33
|
|
|
|
|
|
|
# This is because "" and "0" compress to a longer values (because of |
34
|
|
|
|
|
|
|
# additional format data), and compress_ratio will force them to be stored |
35
|
|
|
|
|
|
|
# uncompressed, thus decompression will never return them. |
36
|
|
|
|
|
|
|
$conf->{compress_methods} //= [ |
37
|
0
|
|
|
0
|
|
0
|
sub { ${ $_[1] } = Compress::Zlib::memGzip( ${ $_[0] } ) }, |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
38
|
0
|
|
|
0
|
|
0
|
sub { ${ $_[1] } = Compress::Zlib::memGunzip( ${ $_[0] } ) }, |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
39
|
21
|
|
100
|
|
|
237
|
]; |
40
|
|
|
|
|
|
|
|
41
|
21
|
|
100
|
|
|
160
|
$conf->{serialize_methods} //= [ \&Storable::nfreeze, \&Storable::thaw ]; |
42
|
|
|
|
|
|
|
|
43
|
21
|
|
|
|
|
1642
|
my $memd = $class->_new($conf); |
44
|
|
|
|
|
|
|
|
45
|
17
|
|
|
|
|
110
|
my $context = [ $memd, $conf ]; |
46
|
17
|
|
|
|
|
93
|
_weaken( $context->[0] ); |
47
|
17
|
|
|
|
|
113
|
$instance{$$memd} = $context; |
48
|
|
|
|
|
|
|
|
49
|
17
|
|
|
|
|
75
|
return $memd; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub CLONE { |
53
|
0
|
|
|
0
|
|
0
|
my $class = shift; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Empty %instance and loop over the values. |
56
|
0
|
|
|
|
|
0
|
for my $context ( delete @instance{ keys %instance } ) { |
57
|
0
|
|
|
|
|
0
|
my ( $memd, $conf ) = @$context; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
my $memd2 = $class->_new($conf); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
$instance{ $$memd = $$memd2 } = $context; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
0
|
$$memd2 = 0; # Prevent destruction in DESTROY. |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub DESTROY { |
68
|
3
|
|
|
3
|
|
9872
|
my $memd = shift; |
69
|
|
|
|
|
|
|
|
70
|
3
|
50
|
|
|
|
15
|
return unless $$memd; |
71
|
|
|
|
|
|
|
|
72
|
3
|
|
|
|
|
53
|
delete $instance{$$memd}; |
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
|
|
173
|
_destroy($memd); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
XSLoader::load; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |