'success', 'message' => "Cache for agent {$agent} is stored." ]); } elseif ($result === null && !empty($agent)) { unset($_SESSION["agent{$agent}_cache"]); unset($_SESSION["agent{$agent}_cache_time"]); echo json_encode([ 'status' => 'success', 'message' => "Cache for agent {$agent} is cleared." ]); } else { echo json_encode([ 'status' => 'error', 'message' => 'Invalid data' ]); } //// if it's a GET request, it's read/load from cache //} elseif ($loadcache === true) { // // // check if cached data exists in session // if (isset($_SESSION["agent{$agent}_cache"])) { // // return the cached data in JSON format // echo json_encode(['status' => 'success', 'data' => $_SESSION["agent{$agent}_cache"]]); // } else { // // if no cached data exists // echo json_encode(['status' => 'error', 'message' => 'No cached data found']); // } // no form submitted, show the templates } else { $agentDetails = $agentObject->getAgentDetails($platform_id); include '../app/templates/agent-list.php'; } ?>