This shouldn't be expected to change, except maybe after an upgrade,
seems worth caching.
To test:
1 - Apply patch
2 - Confirm the feature still works
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
#get a list of available tables for auto-complete
sub get_tables {
my $result = {};
- my $tables = C4::Reports::Guided->get_all_tables();
+ my $cache = Koha::Caches->get_instance();
+ my $tables = $cache->get_from_cache("Reports-SQL_tables-for-autocomplete");
+
+ return $tables
+ if $tables;
+
+ $tables = C4::Reports::Guided->get_all_tables();
for my $table (@{$tables}) {
my $sql = "SHOW COLUMNS FROM $table";
my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} });
push @{$result->{$table}}, $row->{Field};
}
}
+ $cache->set_in_cache("Reports-SQL_tables-for-autocomplete",$result);
return $result;
}