line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Memcached::Client::Serializer::Storable; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
688
|
$Memcached::Client::Serializer::Storable::VERSION = '2.01'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
#ABSTRACT: Implements Memcached Serializing using Storable |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
9
|
1
|
|
|
1
|
|
587
|
use Memcached::Client::Log qw{DEBUG LOG}; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
77
|
|
10
|
1
|
|
|
1
|
|
1326
|
use Storable qw{nfreeze thaw}; |
|
1
|
|
|
|
|
4230
|
|
|
1
|
|
|
|
|
104
|
|
11
|
1
|
|
|
1
|
|
12
|
use base qw{Memcached::Client::Serializer}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
736
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
7
|
use constant F_STORABLE => 1; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
311
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub deserialize { |
16
|
5
|
|
|
5
|
1
|
9
|
my ($self, $data, $flags) = @_; |
17
|
|
|
|
|
|
|
|
18
|
5
|
100
|
|
|
|
18
|
return unless defined $data; |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
100
|
|
|
15
|
$flags ||= 0; |
21
|
|
|
|
|
|
|
|
22
|
4
|
100
|
|
|
|
9
|
if ($flags & F_STORABLE) { |
23
|
1
|
|
|
|
|
2
|
$self->log ("Deserializing data") if DEBUG; |
24
|
1
|
|
|
|
|
6
|
$data = thaw $data; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
56
|
return $data; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub serialize { |
31
|
5
|
|
|
5
|
1
|
177
|
my ($self, $data) = @_; |
32
|
|
|
|
|
|
|
|
33
|
5
|
100
|
|
|
|
38
|
return unless defined $data; |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
6
|
my $flags = 0; |
36
|
|
|
|
|
|
|
|
37
|
4
|
100
|
|
|
|
9
|
if (ref $data) { |
38
|
1
|
|
|
|
|
3
|
$self->log ("Serializing data") if DEBUG; |
39
|
1
|
|
|
|
|
4
|
$data = nfreeze $data; |
40
|
1
|
|
|
|
|
50
|
$flags |= F_STORABLE; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
22
|
return ($data, $flags); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub log { |
48
|
0
|
|
|
0
|
1
|
|
my ($self, $format, @args) = @_; |
49
|
0
|
|
|
|
|
|
LOG ($format, @args); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |