| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alzabo::Runtime::UniqueRowCache; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1543
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
85
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use Alzabo::Runtime::Table; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
45
|
|
|
6
|
2
|
|
|
2
|
|
12295
|
use Alzabo::Runtime::RowState::InCache; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
388
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %CACHE; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
2
|
|
|
2
|
|
6
|
my $real_make_row = \&Alzabo::Runtime::Table::_make_row; |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
10
|
local $^W = 0; |
|
15
|
|
|
|
|
|
|
*Alzabo::Runtime::Table::_make_row = |
|
16
|
0
|
|
|
0
|
|
|
sub { my $self = shift; |
|
17
|
0
|
|
|
|
|
|
my %p = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if ( delete $p{no_cache} ) |
|
20
|
|
|
|
|
|
|
{ |
|
21
|
|
|
|
|
|
|
return |
|
22
|
0
|
|
|
|
|
|
$self->$real_make_row( %p, |
|
23
|
|
|
|
|
|
|
state => 'Alzabo::Runtime::RowState::Live', |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $id = |
|
28
|
|
|
|
|
|
|
Alzabo::Runtime::Row->id_as_string_ext |
|
29
|
|
|
|
|
|
|
( pk => $p{pk}, |
|
30
|
|
|
|
|
|
|
table => $p{table}, |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $table_name = $p{table}->name; |
|
34
|
0
|
0
|
|
|
|
|
return $CACHE{$table_name}{$id} if exists $CACHE{$table_name}{$id}; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $row = |
|
37
|
|
|
|
|
|
|
$self->$real_make_row( %p, |
|
38
|
|
|
|
|
|
|
state => 'Alzabo::Runtime::RowState::InCache', |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
return unless $row; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
Alzabo::Runtime::UniqueRowCache->write_to_cache($row); |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $row; |
|
46
|
2
|
|
|
|
|
325
|
}; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
|
sub clear { %CACHE = () }; |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
|
sub clear_table { delete $CACHE{ $_[1]->name } } |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
1
|
|
sub row_in_cache { return $CACHE{ $_[1] }{ $_[2] } } |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
sub delete_from_cache { delete $CACHE{ $_[1] }{ $_[2] } } |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub write_to_cache { $CACHE{ $_[1]->table->name }{ $_[1]->id_as_string } = $_[1] } |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |