line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Autocache::Strategy; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
1622
|
use Any::Moose; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
23
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
3278
|
use Autocache::Record; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
131
|
|
6
|
5
|
|
|
5
|
|
18
|
use Autocache::Logger qw(get_logger); |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
892
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# get REQ |
10
|
|
|
|
|
|
|
# |
11
|
0
|
|
|
0
|
1
|
0
|
sub get { return undef; } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# set REQ REC |
15
|
|
|
|
|
|
|
# |
16
|
0
|
|
|
0
|
1
|
0
|
sub set { return $_[2]; } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# delete KEY |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
# should we send the request all the way through here too? |
22
|
|
|
|
|
|
|
# |
23
|
0
|
|
|
0
|
1
|
0
|
sub delete { return undef; } |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
0
|
sub clear { return undef; } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# |
29
|
|
|
|
|
|
|
# create REQ |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
# create a cache record by invoking the function to be cached |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
# this generates a basic cache record, strategies built on top of this |
35
|
|
|
|
|
|
|
# should feel free to add their own data elements to the cache record |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
sub create |
38
|
|
|
|
|
|
|
{ |
39
|
132
|
|
|
132
|
0
|
108
|
my ($self,$req) = @_; |
40
|
132
|
|
|
|
|
176
|
get_logger()->debug( "create" ); |
41
|
132
|
|
|
|
|
102
|
my $value; |
42
|
|
|
|
|
|
|
|
43
|
132
|
100
|
|
|
|
223
|
if( $req->context eq 'S' ) |
44
|
|
|
|
|
|
|
{ |
45
|
131
|
|
|
|
|
83
|
$value = $req->generator->( @{$req->args} ); |
|
131
|
|
|
|
|
371
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else |
48
|
|
|
|
|
|
|
{ |
49
|
1
|
|
|
|
|
2
|
my @value = $req->generator->( @{$req->args} ); |
|
1
|
|
|
|
|
4
|
|
50
|
1
|
|
|
|
|
7
|
$value = \@value; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
132
|
|
|
|
|
414
|
my $rec = Autocache::Record->new( |
54
|
|
|
|
|
|
|
name => $req->name, |
55
|
|
|
|
|
|
|
key => $req->key, |
56
|
|
|
|
|
|
|
value => $value, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
132
|
|
|
|
|
195
|
return $rec; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
5
|
|
|
5
|
|
19
|
no Any::Moose; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
18
|
|
63
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |