Sessions/ThreeS/Storage/Memory.pm

filter: Statementstmt 71.4% 10 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 4 / 4 totaltotal 73.9% 17 / 23 CC 1 SCAR 3.4
CC
1
Cov
71%
list_sessions
2.0
remove_session_id
2.0
BEGIN
1.0
CRAP 1.4
« Sessions/ThreeS/State.pm ↑ Summary Sessions/ThreeS/SidGen.pm »
1 package Mojolicious::Sessions::ThreeS::Storage::Memory;
2 2 $Mojolicious::Sessions::ThreeS::Storage::Memory::VERSION = '0.004';
3 2 ▶use Mojo::Base qw/Mojolicious::Sessions::ThreeS::Storage/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 Mojolicious::Sessions::ThreeS::Storage::Memory - A simple in Memory storage for sessions. Nice for tests.
8  
9 =cut
10  
11 2 my $_SESSION_STORE = {};
12  
13 =head2 list_sessions
14  
15 Returns the ArrayRef of sessions for introspection.
16  
17 =cut
18  
19 0 ▶sub list_sessions{
Subroutine list_sessions: not called CC=1 SCAR=6.9
Pod documented
20 0 my ($self) = @_;
21 0 return [ values %$_SESSION_STORE ];
22 }
23  
24 =head2 get_session
25  
26 See L<Mojolicious::Sessions::ThreeS::Storage>
27  
28 =cut
29  
30 5 ▶sub get_session{
Subroutine get_session: called CC=1 SCAR=0.0
Pod documented
31 5 my ($self, $session_id) = @_;
32 5 return $_SESSION_STORE->{$session_id};
33 }
34  
35 =head2 store_session
36  
37 See L<Mojolicious::Sessions::ThreeS::Storage>
38  
39 =cut
40  
41 7 ▶sub store_session{
Subroutine store_session: called CC=1 SCAR=0.0
Pod documented
42 7 my ($self, $session_id, $session) = @_;
43 7 $_SESSION_STORE->{$session_id} = $session;
44 }
45  
46 =head2 remove_session_id
47  
48 See L<Mojolicious::Sessions::ThreeS::Storage>
49  
50 =cut
51  
52 0 ▶sub remove_session_id{
Subroutine remove_session_id: not called CC=1 SCAR=6.9
Pod documented
53 0 my ($self, $session_id) = @_;
54 0 delete $_SESSION_STORE->{$session_id};
55 }
56  
57 2 1;
« Sessions/ThreeS/State.pm ↑ Summary Sessions/ThreeS/SidGen.pm »