From 150e2490f0d122e234bfb783e165e7634ea5f4a3 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 26 Aug 2024 10:22:31 -0400 Subject: [PATCH] Cache protection --- www-api/app/Controllers/WrenchJobs.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www-api/app/Controllers/WrenchJobs.php b/www-api/app/Controllers/WrenchJobs.php index c3e39059..7244f0a1 100644 --- a/www-api/app/Controllers/WrenchJobs.php +++ b/www-api/app/Controllers/WrenchJobs.php @@ -57,11 +57,14 @@ class WrenchJobs extends BaseController if( is_array($out)){ $countItem = count($out); } - + if ( $countItem == 0 ){ $local_url = "http://".$this->micro_service_net1.":3033/marketjobs"; $out = $this->APIcall('GET', $local_url, $in); - $this->saveCache($endpoint,$out,3000); + // dont cache junk + if ( is_array($out) && is_array($out["result_list"]) && count($out["result_list"]) > 0){ + $this->saveCache($endpoint,$out,180); + } $out['internal_return'] = 0; // just backwad comaptobility log_message('critical', "***** ***** WrenchJobs::getJobsData Cache Done:::Ret "); }