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