line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Session::Store::KyotoTycoon; |
2
|
2
|
|
|
2
|
|
40475
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
95
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
46
|
use 5.00800; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
129
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
6
|
2
|
|
|
2
|
|
2035
|
use Cache::KyotoTycoon; |
|
2
|
|
|
|
|
91952
|
|
|
2
|
|
|
|
|
53
|
|
7
|
2
|
|
|
2
|
|
2081
|
use Storable (); |
|
2
|
|
|
|
|
10739
|
|
|
2
|
|
|
|
|
628
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
11
|
0
|
0
|
|
|
|
|
my %args = @_==1 ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
|
|
12
|
0
|
|
0
|
|
|
|
my $kt = Cache::KyotoTycoon->new( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
13
|
|
|
|
|
|
|
host => $args{host} || '127.0.0.1', |
14
|
|
|
|
|
|
|
port => $args{port} || 1978, |
15
|
|
|
|
|
|
|
db => $args{db} || 0, |
16
|
|
|
|
|
|
|
); |
17
|
0
|
|
|
|
|
|
bless {kt => $kt, expires => $args{expires}}, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub select { |
21
|
0
|
|
|
0
|
1
|
|
my ( $self, $session_id ) = @_; |
22
|
0
|
|
|
|
|
|
my $data = $self->{kt}->get($session_id); |
23
|
0
|
0
|
|
|
|
|
if (defined $data) { |
24
|
0
|
|
|
|
|
|
return Storable::thaw($data); |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
|
|
|
|
return undef; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub insert { |
31
|
0
|
|
|
0
|
1
|
|
my ($self, $session_id, $data) = @_; |
32
|
0
|
|
|
|
|
|
$self->{kt}->set( $session_id, Storable::nfreeze($data), $self->{expires} ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub update { |
36
|
0
|
|
|
0
|
1
|
|
my ($self, $session_id, $data) = @_; |
37
|
0
|
|
|
|
|
|
$self->{kt}->replace( $session_id, Storable::nfreeze($data), $self->{expires} ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub delete { |
41
|
0
|
|
|
0
|
1
|
|
my ($self, $session_id) = @_; |
42
|
0
|
|
|
|
|
|
$self->{kt}->remove( $session_id ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
0
|
|
sub cleanup { Carp::croak "This storage doesn't support cleanup" } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |