line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::Lock::Memcached; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
59744
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use base qw(IPC::Lock); |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
1203
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub memcached { |
9
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
10
|
0
|
|
0
|
|
|
|
$self->{memcached} ||= do { |
11
|
0
|
0
|
|
|
|
|
unless($self->{memcached_servers}) { |
12
|
0
|
|
|
|
|
|
die "need \$self->{memcached_servers}, check perldoc for usage"; |
13
|
|
|
|
|
|
|
} |
14
|
0
|
|
|
|
|
|
require Cache::Memcached; |
15
|
0
|
|
|
|
|
|
Cache::Memcached->new({ |
16
|
|
|
|
|
|
|
servers => $self->{memcached_servers}, |
17
|
|
|
|
|
|
|
}); |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub atomic { |
22
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
23
|
0
|
|
|
|
|
|
my $key = shift; |
24
|
0
|
|
|
|
|
|
my $ttl = shift; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self->memcached->add($key, $self->atomic_value, $ttl); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub unatomic { |
30
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
31
|
0
|
|
0
|
|
|
|
my $key = shift || $self->{key}; |
32
|
0
|
|
|
|
|
|
return $self->memcached->delete($key); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |