line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::ExecuteCache; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
900
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
4
|
2
|
|
|
2
|
|
6
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
331
|
|
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
|
68
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
23
|
|
|
|
|
46
|
my $code_ref = $self->NEXT('compile', @_); |
16
|
|
|
|
|
|
|
|
17
|
23
|
50
|
|
|
|
95
|
my $cache = $self->_execute_cache() |
18
|
|
|
|
|
|
|
or return $code_ref; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub { |
21
|
163
|
|
|
163
|
|
2433
|
my $key = join("|", $code_ref, @_); |
22
|
163
|
100
|
|
|
|
237
|
$cache->get( $key ) or $cache->set( $key, $code_ref->( @_ ) ); |
23
|
|
|
|
|
|
|
} |
24
|
23
|
|
|
|
|
141
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _execute_cache { |
27
|
23
|
|
|
23
|
|
26
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
23
|
|
66
|
|
|
64
|
$self->{execute_cache} ||= Text::MicroMason::Cache::Simple->new(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
###################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |