line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::PubSub::Cache::PlainHash; |
2
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
85
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
4
|
2
|
|
|
2
|
|
11
|
use base 'IPC::PubSub::Cache'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
298
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my %cache; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13
|
use constant new => __PACKAGE__; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
765
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub fetch { |
11
|
10
|
|
|
10
|
0
|
12
|
my $self = shift; |
12
|
10
|
|
|
|
|
81
|
@cache{@_}; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub store { |
16
|
11
|
|
|
11
|
0
|
24
|
my ($self, $key, $val, $time, $expiry) = @_; |
17
|
11
|
|
|
|
|
51
|
$cache{$key} = [$time => $val]; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub publisher_indices { |
21
|
28
|
|
|
28
|
0
|
58
|
my ( $self, $chan ) = @_; |
22
|
28
|
100
|
|
|
|
32
|
+{ %{ $cache{$chan} || {} } }; |
|
28
|
|
|
|
|
275
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub add_publisher { |
26
|
7
|
|
|
7
|
0
|
17
|
my ($self, $chan, $pub) = @_; |
27
|
7
|
|
|
|
|
50
|
$cache{$chan}{$pub} = 0; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub remove_publisher { |
31
|
7
|
|
|
7
|
0
|
20
|
my ($self, $chan, $pub) = @_; |
32
|
7
|
|
|
|
|
72
|
delete $cache{$chan}{$pub}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_index { |
36
|
2
|
|
|
2
|
0
|
5
|
my ($self, $chan, $pub) = @_; |
37
|
2
|
|
|
|
|
15
|
$cache{$chan}{$pub}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub set_index { |
41
|
9
|
|
|
9
|
0
|
16
|
my ($self, $chan, $pub, $idx) = @_; |
42
|
9
|
|
|
|
|
41
|
$cache{$chan}{$pub} = $idx; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |