| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Apache::Session::Store::SharedMem |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Copyright 2004, Simon Wistow |
|
4
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or |
|
5
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Apache::Session::Store::SharedMem; |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use IPC::Cache; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
305
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
3
|
|
|
3
|
0
|
4564
|
my ($class, $session) = shift; |
|
18
|
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
7
|
my ($self, $cacheargs); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
13
|
$cacheargs->{namespace} = $session->{data}->{_session_id}; |
|
23
|
3
|
|
|
|
|
10
|
$cacheargs->{expires_in} = $session->{args}->{expires_in}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
19
|
$self->{cache} = new IPC::Cache ( $cacheargs ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
934
|
return bless $self, $class; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub insert { |
|
31
|
|
|
|
|
|
|
|
|
32
|
2
|
|
|
2
|
0
|
448
|
my ($self, $session) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
19
|
$self->{cache}->set($session->{data}->{_session_id}, $session->{serialized}); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub update { |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
0
|
44
|
my ($self, $session) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
8
|
$self->{cache}->set($session->{data}->{_session_id}, $session->{serialized}); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub materialize { |
|
45
|
1
|
|
|
1
|
0
|
53
|
my ($self, $session) = @_; |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
8
|
$session->{serialized} = $self->{cache}->get($session->{data}->{_session_id}); |
|
48
|
1
|
50
|
|
|
|
92
|
return undef unless defined $session->{serialized}; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub remove { |
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
|
|
2
|
0
|
268
|
my ($self, $session) = @_; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
12
|
$self->{cache}->clear(); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
2
|
|
|
2
|
0
|
5
|
sub close { |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Apache::Session::Store::SharedMem - Store persistent data in shared memory |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
use Apache::Session::Store::SharedMem; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $store = new Apache::Session::Store::SharedMem; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$store->insert($ref); |
|
82
|
|
|
|
|
|
|
$store->update($ref); |
|
83
|
|
|
|
|
|
|
$store->materialize($ref); |
|
84
|
|
|
|
|
|
|
$store->remove($ref); |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This module fulfills the storage interface of B. The serialized |
|
89
|
|
|
|
|
|
|
objects are stored in shared memory. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 OPTIONS |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This module can optionally take one argument in the usual Apache::Session style. |
|
94
|
|
|
|
|
|
|
The name of the option is B, and the value is the amount of time, in |
|
95
|
|
|
|
|
|
|
seconds, that the data in the session will expire in. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# session wil expire in a day |
|
99
|
|
|
|
|
|
|
tie %s, 'Apache::Session::SharedMem', undef, { expires_in => 86400 }; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This module was written by Simon Wistow . |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright 2000, 2001 Simon Wistow |
|
110
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
|
111
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L, L, L |