line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::ExecuteCache; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1101
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
411
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Text::MicroMason::Base; |
7
|
|
|
|
|
|
|
require Text::MicroMason::Cache::Simple; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
###################################################################### |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# $code_ref = compile( text => $template ); |
12
|
|
|
|
|
|
|
sub compile { |
13
|
23
|
|
|
23
|
1
|
77
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
23
|
|
|
|
|
63
|
my $code_ref = $self->NEXT('compile', @_); |
16
|
|
|
|
|
|
|
|
17
|
23
|
50
|
|
|
|
132
|
my $cache = $self->_execute_cache() |
18
|
|
|
|
|
|
|
or return $code_ref; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub { |
21
|
163
|
|
|
163
|
|
3456
|
my $key = join("|", $code_ref, @_); |
22
|
163
|
100
|
|
|
|
331
|
$cache->get( $key ) or $cache->set( $key, $code_ref->( @_ ) ); |
23
|
|
|
|
|
|
|
} |
24
|
23
|
|
|
|
|
179
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _execute_cache { |
27
|
23
|
|
|
23
|
|
40
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
23
|
|
66
|
|
|
83
|
$self->{execute_cache} ||= Text::MicroMason::Cache::Simple->new(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
###################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |