aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/utils/CacheUtils.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-17 11:39:47 +0000
committersaturneric <[email protected]>2024-01-17 11:39:47 +0000
commite352e8e6b8d03a24ef5d52eef3e4d370807b5bbd (patch)
tree9a59f0b573a845644afe4b8857a89c4b28bdcc0d /src/core/utils/CacheUtils.cpp
parentfix: solve the gnupg tab options info not shown issue (diff)
downloadGpgFrontend-e352e8e6b8d03a24ef5d52eef3e4d370807b5bbd.tar.gz
GpgFrontend-e352e8e6b8d03a24ef5d52eef3e4d370807b5bbd.zip
fix: find and slove some bugs
Diffstat (limited to 'src/core/utils/CacheUtils.cpp')
-rw-r--r--src/core/utils/CacheUtils.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/core/utils/CacheUtils.cpp b/src/core/utils/CacheUtils.cpp
index 5e8657fa..e521870c 100644
--- a/src/core/utils/CacheUtils.cpp
+++ b/src/core/utils/CacheUtils.cpp
@@ -32,21 +32,15 @@
namespace GpgFrontend {
-void SetTempCacheValue(const QString& key, const QString& value) {
- QJsonDocument json;
- json.setObject(QJsonObject({{key, value}}));
- CacheManager::GetInstance().SaveCache(key, json);
+void SetCacheValue(const QString& key, QString value) {
+ CacheManager::GetInstance().SaveCache(key, std::move(value));
}
-auto GetTempCacheValue(const QString& key) -> QString {
- QJsonDocument json = CacheManager::GetInstance().LoadCache(key);
- if (!json.isObject()) return {};
- auto json_object = json.object();
- if (!json_object.contains(key) && json_object[key].isString()) return {};
- return json_object[key].toString();
+auto GetCacheValue(const QString& key) -> QString {
+ return CacheManager::GetInstance().LoadCache(key);
}
-void ResetTempCacheValue(const QString& key) {
+void ResetCacheValue(const QString& key) {
CacheManager::GetInstance().ResetCache(key);
}