line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Sessions::ThreeS::Storage::Memory; |
2
|
|
|
|
|
|
|
$Mojolicious::Sessions::ThreeS::Storage::Memory::VERSION = '0.002'; |
3
|
1
|
|
|
1
|
|
257819
|
use Mojo::Base qw/Mojolicious::Sessions::ThreeS::Storage/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
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
|
|
|
|
|
|
|
my $_SESSION_STORE = {}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head2 list_sessions |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Returns the ArrayRef of sessions for introspection. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub list_sessions{ |
20
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
21
|
0
|
|
|
|
|
0
|
return [ values %$_SESSION_STORE ]; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 get_session |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
See L |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_session{ |
31
|
5
|
|
|
5
|
1
|
19
|
my ($self, $session_id) = @_; |
32
|
5
|
|
|
|
|
11
|
return $_SESSION_STORE->{$session_id}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 store_session |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
See L |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub store_session{ |
42
|
7
|
|
|
7
|
1
|
27
|
my ($self, $session_id, $session) = @_; |
43
|
7
|
|
|
|
|
16
|
$_SESSION_STORE->{$session_id} = $session; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 remove_session_id |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
See L |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub remove_session_id{ |
53
|
0
|
|
|
0
|
1
|
|
my ($self, $session_id) = @_; |
54
|
0
|
|
|
|
|
|
delete $_SESSION_STORE->{$session_id}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |