| 1 | package Apache::Session::Store::Memcached; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use Cache::Memcached; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 3 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 3 | $VERSION = '0.03'; | |||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 9 | 4 | my($class,$session) = @_; | |||||||||||||||||||
| 10 | 4 | my $self; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | my %opts = ( | ||||||||||||||||||||
| 13 | servers => ( ref $session->{args}->{Servers} eq 'ARRAY' ) | ||||||||||||||||||||
| 14 | ? $session->{args}->{Servers} : [ split(/\s+/,$session->{args}->{Servers}) ], | ||||||||||||||||||||
| 15 | no_rehash => $session->{args}->{NoRehash}, | ||||||||||||||||||||
| 16 | readonly => $session->{args}->{ReadOnly}, | ||||||||||||||||||||
| 17 | debug => $session->{args}->{Debug}, | ||||||||||||||||||||
| 18 | 4 | ▶ | compress_threshold => $session->{args}->{CompressThreshold} || 10_000, | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$session->{'args'}{'CompressThreshold'} || 10000
MC/DC0%0/1
$session->{'args'}{'CompressThreshold'} || 10000
$session->{'args'}{'CompressThreshold'}
Truth table50%1/2
A
A= $session->{'args'}{'CompressThreshold'}
| |||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | #use Data::Dumper; | ||||||||||||||||||||
| 22 | #print STDERR Dumper $session->{args}; | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 4 | my $memd = new Cache::Memcached \%opts; | |||||||||||||||||||
| 25 | 4 | $self->{cache} = $memd; | |||||||||||||||||||
| 26 | 4 | bless $self,$class; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 2 | ▶ | sub insert { | ||||||||||||||||||
|
Subroutine
insert: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 30 | 2 | my($self,$session) = @_; | |||||||||||||||||||
| 31 | 2 | ▶ | if ( $self->{cache}->get($session->{data}->{_session_id}) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | 0 | die "Object already exists in the data store."; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | 2 | $self->{cache}->set($session->{data}->{_session_id},$session->{serialized}); | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 2 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 38 | 2 | my($self,$session) = @_; | |||||||||||||||||||
| 39 | 2 | $self->{cache}->replace($session->{data}->{_session_id},$session->{serialized}); | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 2 | ▶ | sub materialize { | ||||||||||||||||||
|
Subroutine
materialize: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 43 | 2 | my($self, $session) = @_; | |||||||||||||||||||
| 44 | 2 | ▶ | $session->{serialized} = $self->{cache}->get($session->{data}->{_session_id}) or die 'Object does not exist in data store.'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 0 | ▶ | sub remove { | ||||||||||||||||||
|
Subroutine
remove: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 48 | 0 | my($self, $session) = @_; | |||||||||||||||||||
| 49 | 0 | $self->{cache}->delete($session->{data}->{_session_id}); | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 3 | 1; | |||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||