From e25498a86a414f5e0459098a88dca4f55708a81b Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Mon, 29 Apr 2024 20:25:52 +0200 Subject: [PATCH] bypass api cache --- src/API/CAPIClient.cpp | 4 ++-- src/API/CAPIClient.h | 2 +- src/Main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/API/CAPIClient.cpp b/src/API/CAPIClient.cpp index 70201a4..a7e75b0 100644 --- a/src/API/CAPIClient.cpp +++ b/src/API/CAPIClient.cpp @@ -55,11 +55,11 @@ CAPIClient::~CAPIClient() LogDebug(("CAPIClient::" + BaseURL).c_str(), "~CAPIClient(%s)", BaseURL.c_str()); } -json CAPIClient::Get(std::string aEndpoint, std::string aParameters) +json CAPIClient::Get(std::string aEndpoint, std::string aParameters, bool aBypassCache) { std::string query = GetQuery(aEndpoint, aParameters); - CachedResponse* cachedResponse = GetCachedResponse(query); + CachedResponse* cachedResponse = aBypassCache ? nullptr : GetCachedResponse(query); if (cachedResponse != nullptr) { diff --git a/src/API/CAPIClient.h b/src/API/CAPIClient.h index 2c61fae..4c86008 100644 --- a/src/API/CAPIClient.h +++ b/src/API/CAPIClient.h @@ -37,7 +37,7 @@ class CAPIClient Get: Returns the response string. */ - json Get(std::string aEndpoint, std::string aParameters = ""); + json Get(std::string aEndpoint, std::string aParameters = "", bool aBypassCache = false); json Post(std::string aEndpoint, std::string aParameters = ""); /* diff --git a/src/Main.cpp b/src/Main.cpp index 01a783b..b5eae75 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -168,7 +168,7 @@ namespace Main std::filesystem::remove(Path::F_OLD_DLL); } - json resVersion = RaidcoreAPI->Get("/nexusversion");; + json resVersion = RaidcoreAPI->Get("/nexusversion", "", true); if (resVersion.is_null()) {