From cf5d16f8fcd8eff0c6b3e67cbf1b2e97f4660720 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 20 Jul 2024 19:17:23 -0400 Subject: [PATCH] Fix cache --- www-api/app/Controllers/WrenchJobs.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/www-api/app/Controllers/WrenchJobs.php b/www-api/app/Controllers/WrenchJobs.php index 08758e5e..7ae61e52 100644 --- a/www-api/app/Controllers/WrenchJobs.php +++ b/www-api/app/Controllers/WrenchJobs.php @@ -17,9 +17,16 @@ class WrenchJobs extends BaseController $in = json_decode($raw_json, true); $in["action"] = WRENCHBOARD_JOB_STATS_INTEREST; $out=[]; - $ret = $this->wrenchboard->wrenchboard_api($in, $out); - $out['internal_return'] = $ret; - log_message('critical', "***** ***** WrenchJobs::interestStats Ret = ".$ret ); + $endpoint = "CLIENT_STATS-". $in["client_id"]; + + $out = $this->getCache($endpoint); + if ( count($out)==0 ){ + $ret = $this->wrenchboard->wrenchboard_api($in, $out); + $this->saveCache($endpoint,$out,15000); + $out['internal_return'] = $ret; + log_message('critical', "***** ***** WrenchJobs::interestStats Cache Done:::Ret ". $ret); + } + log_message('critical', "***** ***** WrenchJobs::interestStats Ret "); return $this->respond( $this->summaryReturnData($in,$out), 200); }