line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
OpenFrame::WebApp::Session::CacheBase - abstract base for sessions using |
4
|
|
|
|
|
|
|
Cache::Cache modules |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# abstract class - cannot be instantiated |
9
|
|
|
|
|
|
|
use base qw( OpenFrame::WebApp::Session::CacheBase ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package OpenFrame::WebApp::Session::CacheBase; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
97
|
|
16
|
3
|
|
|
3
|
|
15
|
use warnings::register; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
359
|
|
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
91
|
use Error; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
20
|
|
19
|
3
|
|
|
3
|
|
1183
|
use OpenFrame::WebApp::Error::Abstract; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
22
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = (split(/ /, '$Revision: 1.1 $'))[1]; |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
3
|
|
205
|
use base qw( OpenFrame::WebApp::Session ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1353
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub cache_class { |
26
|
|
|
|
|
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
throw OpenFrame::WebApp::Error::Abstract( class => ref($self) ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub store { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
my $expiry = $self->get_expiry_seconds; |
33
|
|
|
|
|
|
|
my @args = ($self->id, $self); |
34
|
|
|
|
|
|
|
push (@args, "$expiry s") if (defined $expiry); |
35
|
|
|
|
|
|
|
$self->cache_class->new()->set( @args ); |
36
|
|
|
|
|
|
|
return $self->id; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub fetch { |
40
|
|
|
|
|
|
|
my $class = shift; |
41
|
|
|
|
|
|
|
my $id = shift || return; |
42
|
|
|
|
|
|
|
return $class->cache_class->new({auto_purge_on_get => 1})->get( $id ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub remove { |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
my $id = ref($self) ? $self->id : shift; |
48
|
|
|
|
|
|
|
$self->cache_class->new()->remove( $id ); |
49
|
|
|
|
|
|
|
return $self; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
An C for using C modules. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Steve Purkis |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Based on C, by James A. Duncan. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Copyright (c) 2003 Steve Purkis. All rights reserved. |
68
|
|
|
|
|
|
|
Released under the same license as Perl itself. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L, |
73
|
|
|
|
|
|
|
L, |
74
|
|
|
|
|
|
|
L, |
75
|
|
|
|
|
|
|
L |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |