Revision bba2bff3
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/DB/Chart.pm | ||
---|---|---|
18 | 18 |
$date ||= DateTime->today_local; |
19 | 19 |
|
20 | 20 |
my $cache = $::request->cache("get_active_taxkey")->{$date} //= {}; |
21 |
if ($cache->{$self->id}) { |
|
22 |
return $cache->{$self->id}; |
|
23 |
} |
|
21 |
return $cache->{$self->id} if $cache->{$self->id}; |
|
24 | 22 |
|
25 | 23 |
require SL::DB::TaxKey; |
26 |
return SL::DB::Manager::TaxKey->get_all(query => [ and => [ chart_id => $self->id, |
|
27 |
startdate => { le => $date } ] ], |
|
28 |
sort_by => "startdate DESC")->[0]; |
|
24 |
return $cache->{$self->id} = SL::DB::Manager::TaxKey->get_all( |
|
25 |
query => [ and => [ chart_id => $self->id, |
|
26 |
startdate => { le => $date } ] ], |
|
27 |
sort_by => "startdate DESC")->[0]; |
|
29 | 28 |
} |
30 | 29 |
|
31 | 30 |
1; |
SL/DB/Manager/Chart.pm | ||
---|---|---|
26 | 26 |
my ($self, %params) = @_; |
27 | 27 |
|
28 | 28 |
my $date = $params{date} || DateTime->today; |
29 |
my $cache = $::request->{cache}{chart}{$date} ||= {};
|
|
29 |
my $cache = $::request->cache('::SL::DB::Chart::get_active_taxkey')->{$date} //= {};
|
|
30 | 30 |
|
31 | 31 |
require SL::DB::TaxKey; |
32 | 32 |
my $tks = SL::DB::Manager::TaxKey->get_all; |
Auch abrufbar als: Unified diff
SL::DB::Part: Cachen von Objekten gefixt Teil 2
get_active_taxkey hat vorher ganz einfach nicht gecachet.