$date ||= DateTime->today_local;
my $cache = $::request->cache("get_active_taxkey")->{$date} //= {};
- if ($cache->{$self->id}) {
- return $cache->{$self->id};
- }
+ return $cache->{$self->id} if $cache->{$self->id};
require SL::DB::TaxKey;
- return SL::DB::Manager::TaxKey->get_all(query => [ and => [ chart_id => $self->id,
- startdate => { le => $date } ] ],
- sort_by => "startdate DESC")->[0];
+ return $cache->{$self->id} = SL::DB::Manager::TaxKey->get_all(
+ query => [ and => [ chart_id => $self->id,
+ startdate => { le => $date } ] ],
+ sort_by => "startdate DESC")->[0];
}
1;
my ($self, %params) = @_;
my $date = $params{date} || DateTime->today;
- my $cache = $::request->{cache}{chart}{$date} ||= {};
+ my $cache = $::request->cache('::SL::DB::Chart::get_active_taxkey')->{$date} //= {};
require SL::DB::TaxKey;
my $tks = SL::DB::Manager::TaxKey->get_all;