line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# set session - item |
4
|
|
|
|
|
|
|
# set session - content |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# set - item |
7
|
|
|
|
|
|
|
# set - content |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Data::Fallback::Memory; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use Data::Fallback; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
14
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
361
|
|
15
|
|
|
|
|
|
|
@ISA = qw(Data::Fallback); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub get_memory_cache_key { |
18
|
10
|
|
|
10
|
0
|
12
|
my $self = shift; |
19
|
10
|
|
|
|
|
30
|
return $self->get_cache_key('primary_key') . "-" . $self->{item}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _GET { |
23
|
5
|
|
|
5
|
|
6
|
my $self = shift; |
24
|
5
|
|
|
|
|
6
|
my $return = 0; |
25
|
5
|
|
|
|
|
13
|
my ($found_in_cache, $content) = |
26
|
|
|
|
|
|
|
$self->check_cache('Memory', 'item', $self->get_memory_cache_key); |
27
|
|
|
|
|
|
|
|
28
|
5
|
50
|
|
|
|
13
|
if($found_in_cache) { |
29
|
|
|
|
|
|
|
# already set in $content, so we're done |
30
|
0
|
|
|
|
|
0
|
$self->{update}{item} = $content; |
31
|
0
|
|
|
|
|
0
|
$return = 1; |
32
|
|
|
|
|
|
|
} |
33
|
5
|
|
|
|
|
17
|
return $return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub SET_ITEM { |
37
|
5
|
|
|
5
|
0
|
6
|
my $self = shift; |
38
|
5
|
|
|
|
|
8
|
my ($key, $value) = ($self->get_memory_cache_key, $self->{update}{item}); |
39
|
5
|
50
|
33
|
|
|
26
|
die "need a \$self->{list_name}" unless( (defined $self->{list_name}) && length $self->{list_name}); |
40
|
5
|
50
|
33
|
|
|
23
|
die "need a \$key" unless( (defined $key) && length $key); |
41
|
5
|
50
|
33
|
|
|
24
|
die "need a \$value" unless( (defined $value) && length $value); |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
18
|
return $self->set_cache('Memory', 'item', $key, $value); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub SET_GROUP { |
47
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# can't really set a group in Memory, since the content name is different |
50
|
|
|
|
|
|
|
# at each driver level |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return 1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |