line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Catalyst::Plugin::Cache::Backend::Memory; |
4
|
2
|
|
|
2
|
|
76136
|
use Storable; |
|
2
|
|
|
|
|
34043
|
|
|
2
|
|
|
|
|
168
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
24
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
72
|
|
7
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
72
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use Storable qw/freeze thaw/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1031
|
|
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
0
|
|
sub new { bless {}, shift } |
12
|
|
|
|
|
|
|
|
13
|
0
|
0
|
|
0
|
0
|
|
sub get { ${thaw($_[0]{$_[1]}) || return} }; |
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
0
|
|
sub set { $_[0]{$_[1]} = freeze(\$_[2]) }; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
0
|
0
|
|
sub remove { delete $_[0]{$_[1]} }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Catalyst::Plugin::Cache::Backend::Memory - Stupid memory based caching backend. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Catalyst::Plugin::Cache::Backend::Memory; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $m = Catalyst::Plugin::Cache::Backend::Memory->new; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$m->set( foo => "thing" ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This backend uses L<Storable> to cache data in memory. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
In combination with an engine like FastCGI/mod_perl/prefork which calls fork() |
42
|
|
|
|
|
|
|
your cache will get async because child processes don't share cache in memory. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|