Webqq/Cache.pm

filter: Statementstmt 5.0% 1 / 20 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 4 totaltotal 2.9% 1 / 34 CC 4 SCAR 25.1
CC
4
Cov
4%
retrieve
20.0
new
2.0
store
2.0
CRAP 12.3
« Webqq/Base.pm ↑ Summary Webqq/Client/Remote/_cookie_proxy.pm »
1 package Mojo::Webqq::Cache;
2 0 ▶sub new{
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
3 0 return bless {}
4 }
5 0 ▶sub store {
Subroutine store: not called CC=1 SCAR=6.9
Pod undocumented
6 0 my $self= shift;
7 0 my ($data_key,$data,$ttl) = @_;
8 0 $self->{$data_key}{data} = $data;
9 0 $self->{$data_key}{ttl} = $ttl;
10 0 $self->{$data_key}{ctime} = time;
11
12 }
13 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod undocumented
14 0 my $self= shift;
15 0 my $data_key = shift;
16 0 delete $self->{$data_key};
17 }
18 0 ▶sub retrieve{
Subroutine retrieve: not called CC=4 SCAR=30.0
Pod undocumented
19 0 my $self = shift;
20 0 my $data_key = shift;
21 0 ▶ if(exists $self->{$data_key} ){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$data_key}) { } 0 0 0
22 0 ▶ if(defined $self->{$data_key}{ttl}){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$data_key}{'ttl'}) { } 0 0 0
23 0 ▶ if($self->{$data_key}{ttl} + $self->{$data_key}{ctime} > time){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{$data_key}{'ttl'} + $self->{$data_key}{'ctime'} > time) { } 0 0 0
24 0 return $self->{$data_key}{data};
25 }
26 0 else{delete $self->{$data_key};return undef}
27 }
28 else{
29 0 return $self->{$data_key}{data};
30 }
31 }
32 0 else{return undef}
33 }
34 1 1;
« Webqq/Base.pm ↑ Summary Webqq/Client/Remote/_cookie_proxy.pm »