refactored the cache loader

- adjusted formatting to make it easier to read
- added the key prefix from config
- made everything failsafe since users don't have that configured by default
This commit is contained in:
HB9HIL
2026-02-01 20:21:14 +01:00
parent 6299e02e81
commit 9e19dec6bf
8 changed files with 40 additions and 8 deletions

View File

@@ -1255,7 +1255,11 @@ class API extends CI_Controller {
}
// Load cache driver
$this->load->driver('cache', ['adapter' => $this->config->item('cache_adapter'), 'backup' => $this->config->item('cache_backup')]);
$this->load->driver('cache', [
'adapter' => $this->config->item('cache_adapter') ?? 'file',
'backup' => $this->config->item('cache_backup') ?? 'file',
'key_prefix' => $this->config->item('cache_key_prefix') ?? ''
]);
// Create cache key
$cache_key = "wp_stats_{$station_id}";