| 1 | package Alzabo::Runtime::RowState::InCache; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use base qw(Alzabo::Runtime::RowState::Live); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | BEGIN | ||||||||||
| 8 | 2 | ▶ | { | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=8.3
| |||||||||||
| 9 | 2 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | foreach my $meth ( qw( select select_hash ) ) | |||||||||
| 11 | { | ||||||||||
| 12 | 4 | my $super = "SUPER::$meth"; | |||||||||
| 13 | 4 | *{__PACKAGE__ . "::$meth"} = | |||||||||
| 14 | 0 | ▶ | sub { my $s = shift; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | $s->refresh(@_) unless $s->_in_cache(@_); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 0 | $s->$super(@_); | |||||||||
| 19 | 4 | }; | |||||||||
| 20 | } | ||||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | sub update | ||||||||||
| 24 | 0 | ▶ | { | ||||||||
|
Subroutine
update: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 25 | 0 | my $class = shift; | |||||||||
| 26 | 0 | my $row = shift; | |||||||||
| 27 | |||||||||||
| 28 | 0 | my $old_id = $row->id_as_string; | |||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | $class->refresh($row) unless $class->_in_cache($row); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | |||||||||||
| 32 | 0 | my $changed = $class->SUPER::update( $row, @_ ); | |||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | return $changed if exists $row->{id_string}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | 0 | Alzabo::Runtime::UniqueRowCache->delete_from_cache( $row->table->name, $old_id ); | |||||||||
| 37 | |||||||||||
| 38 | 0 | Alzabo::Runtime::UniqueRowCache->write_to_cache($row); | |||||||||
| 39 | |||||||||||
| 40 | 0 | return $changed; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | sub delete | ||||||||||
| 44 | 0 | ▶ | { | ||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 45 | 0 | my $class = shift; | |||||||||
| 46 | 0 | my $row = shift; | |||||||||
| 47 | |||||||||||
| 48 | 0 | my $old_id = $row->id_as_string; | |||||||||
| 49 | |||||||||||
| 50 | 0 | $class->SUPER::delete( $row, @_ ); | |||||||||
| 51 | |||||||||||
| 52 | 0 | Alzabo::Runtime::UniqueRowCache->delete_from_cache( $row->table->name, $old_id ); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | sub refresh | ||||||||||
| 56 | 0 | ▶ | { | ||||||||
|
Subroutine
refresh: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 57 | 0 | my $class = shift; | |||||||||
| 58 | |||||||||||
| 59 | 0 | $class->SUPER::refresh(@_); | |||||||||
| 60 | |||||||||||
| 61 | # return if $class->_in_cache($row); #???? | ||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | sub _in_cache | ||||||||||
| 65 | 0 | ▶ | { | ||||||||
|
Subroutine
_in_cache: not called CC=1 SCAR=6.9
| |||||||||||
| 66 | return | ||||||||||
| 67 | 0 | Alzabo::Runtime::UniqueRowCache->row_in_cache | |||||||||
| 68 | ( $_[1]->table->name, $_[1]->id_as_string ); | ||||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | sub _write_to_cache | ||||||||||
| 72 | 0 | ▶ | { | ||||||||
|
Subroutine
_write_to_cache: not called CC=1 SCAR=6.9
| |||||||||||
| 73 | 0 | Alzabo::Runtime::UniqueRowCache->write_to_cache( $_[1] ); | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | |||||||||||
| 77 | 2 | 1; | |||||||||
| 78 | |||||||||||
| 79 | __END__ | ||||||||||