| 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 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Data::Fallback; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | @ISA = qw(Data::Fallback); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 10 | ▶ | sub get_memory_cache_key { | ||||||||||||||||||||||||||
|
Subroutine
get_memory_cache_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 19 | 10 | return $self->get_cache_key('primary_key') . "-" . $self->{item}; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 5 | ▶ | sub _GET { | ||||||||||||||||||||||||||
|
Subroutine
_GET: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 23 | 5 | my $self = shift; | |||||||||||||||||||||||||||
| 24 | 5 | my $return = 0; | |||||||||||||||||||||||||||
| 25 | 5 | my ($found_in_cache, $content) = | |||||||||||||||||||||||||||
| 26 | $self->check_cache('Memory', 'item', $self->get_memory_cache_key); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 5 | ▶ | if($found_in_cache) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | # already set in $content, so we're done | ||||||||||||||||||||||||||||
| 30 | 0 | $self->{update}{item} = $content; | |||||||||||||||||||||||||||
| 31 | 0 | $return = 1; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | 5 | return $return; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 5 | ▶ | sub SET_ITEM { | ||||||||||||||||||||||||||
|
Subroutine
SET_ITEM: called CC=7 SCAR=23.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | 5 | my $self = shift; | |||||||||||||||||||||||||||
| 38 | 5 | my ($key, $value) = ($self->get_memory_cache_key, $self->{update}{item}); | |||||||||||||||||||||||||||
| 39 | 5 | ▶ | die "need a \$self->{list_name}" unless( (defined $self->{list_name}) && length $self->{list_name}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->{"list_name"} and length $self->{"list_name"}
MC/DC0%0/2
defined $self->{"list_name"} and length $self->{"list_name"}
defined $self->{"list_name"}
length $self->{"list_name"}
Truth table33%1/3
A and B
A= defined $self->{"list_name"}B= length $self->{"list_name"}
| |||||||||||||||||||||||||||||
| 40 | 5 | ▶ | die "need a \$key" unless( (defined $key) && length $key); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $key and length $key
MC/DC0%0/2
defined $key and length $key
defined $key
length $key
Truth table33%1/3
A and B
A= defined $keyB= length $key
| |||||||||||||||||||||||||||||
| 41 | 5 | ▶ | die "need a \$value" unless( (defined $value) && length $value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and length $value
MC/DC0%0/2
defined $value and length $value
defined $value
length $value
Truth table33%1/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 5 | return $self->set_cache('Memory', 'item', $key, $value); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub SET_GROUP { | ||||||||||||||||||||||||||
|
Subroutine
SET_GROUP: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 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 | 1; | |||||||||||||||||||||||||||