| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catalyst::Plugin::Cache::FastMmap; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2864
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
58
|
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
36
|
|
|
5
|
1
|
|
|
1
|
|
2068
|
use MRO::Compat; |
|
|
1
|
|
|
|
|
15676
|
|
|
|
1
|
|
|
|
|
37
|
|
|
6
|
1
|
|
|
1
|
|
48
|
use base 'Class::Data::Inheritable'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
3211
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3405
|
use Cache::FastMmap; |
|
|
1
|
|
|
|
|
20348
|
|
|
|
1
|
|
|
|
|
2699
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION= '0.9'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('cache'); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub setup { |
|
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my %params = (); |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if ( $self->config->{cache} ) { |
|
20
|
0
|
|
|
|
|
|
%params = %{ $self->config->{cache} }; |
|
|
0
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ( $params{storage} ) { |
|
24
|
0
|
|
|
|
|
|
$params{share_file} = delete $params{storage}; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if ( $params{expires} ) { |
|
28
|
0
|
|
|
|
|
|
$params{expire_time} = delete $params{expires}; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->cache( Cache::FastMmap->new(%params) ); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return $self->next::method(@_); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Catalyst::Plugin::Cache::FastMmap - DEPRECATED FastMmap cache |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Catalyst qw[Cache::FastMmap]; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
MyApp->config( |
|
50
|
|
|
|
|
|
|
cache => { |
|
51
|
|
|
|
|
|
|
storage => '/tmp/cache', |
|
52
|
|
|
|
|
|
|
xpires => 3600, |
|
53
|
|
|
|
|
|
|
}, |
|
54
|
|
|
|
|
|
|
); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $data; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
unless ( $data = $c->cache->get('data') ) { |
|
59
|
|
|
|
|
|
|
$data = MyApp::Model::Data->retrieve('data'); |
|
60
|
|
|
|
|
|
|
$c->cache->set( 'data', $data ); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$c->response->body($data); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This package is part of the Catalyst Cache family. It allows |
|
69
|
|
|
|
|
|
|
integration of L<Cache::FastMmap> and L<Catalyst> |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This module extends the Catalyst application class with a C<mmap> cache. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This module is not recommended for production use, as L<Cache::FastMmap> can |
|
74
|
|
|
|
|
|
|
segfault and/or unexpectedly throw away your data. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 METHODS |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item setup |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Sets up the cache |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item cache |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns an instance of C<Cache::FastMmap> |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L<Cache::FastMmap>, L<Catalyst>. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Christian Hansen, C<ch@ngmedia.com> |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Sebastian Riedel, C<sri@oook.de> |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 LICENSE |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This library is free software . You can redistribute it and/or modify it under |
|
103
|
|
|
|
|
|
|
the same terms as perl itself. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright (c) 2005-2011, the above mentioned AUTHORs. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |