From e7694f9a0729cb88064eda6623c99070f5a46dc0 Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 2 Jun 2024 22:03:59 +0200 Subject: feat: rewrite key list structure and logic --- src/core/function/CacheManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/function/CacheManager.cpp') diff --git a/src/core/function/CacheManager.cpp b/src/core/function/CacheManager.cpp index 719c962d..4dd12f59 100644 --- a/src/core/function/CacheManager.cpp +++ b/src/core/function/CacheManager.cpp @@ -165,9 +165,10 @@ class CacheManager::Impl : public QObject { * */ void slot_flush_cache_storage() { + GF_CORE_LOG_TRACE("write cache to file system..."); + for (const auto& cache : durable_cache_storage_.mirror()) { auto key = get_data_object_key(cache.first); - GF_CORE_LOG_TRACE("save cache into filesystem, key {}", key); GpgFrontend::DataObjectOperator::GetInstance().SaveDataObj( key, QJsonDocument(cache.second)); } -- cgit v1.2.3 From 37a62a8d0b590710b902376ca3320cc05e954b63 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 26 Jul 2024 18:24:34 +0200 Subject: feat: remove spdlog and clean up log --- src/core/function/CacheManager.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/core/function/CacheManager.cpp') diff --git a/src/core/function/CacheManager.cpp b/src/core/function/CacheManager.cpp index 4dd12f59..e71936fe 100644 --- a/src/core/function/CacheManager.cpp +++ b/src/core/function/CacheManager.cpp @@ -107,7 +107,6 @@ class CacheManager::Impl : public QObject { durable_cache_storage_.insert(key, value); if (!key_storage_.contains(key)) { - GF_CORE_LOG_DEBUG("register new key of cache", key); key_storage_.push_back(key); } @@ -126,8 +125,8 @@ class CacheManager::Impl : public QObject { return {}; } - auto LoadDurableCache(const QString& key, QJsonDocument default_value) - -> QJsonDocument { + auto LoadDurableCache(const QString& key, + QJsonDocument default_value) -> QJsonDocument { auto data_object_key = get_data_object_key(key); if (!durable_cache_storage_.exists(key)) { durable_cache_storage_.insert( @@ -165,7 +164,7 @@ class CacheManager::Impl : public QObject { * */ void slot_flush_cache_storage() { - GF_CORE_LOG_TRACE("write cache to file system..."); + qCDebug(core, "write cache to file system..."); for (const auto& cache : durable_cache_storage_.mirror()) { auto key = get_data_object_key(cache.first); @@ -216,7 +215,7 @@ class CacheManager::Impl : public QObject { * */ void load_all_cache_storage() { - GF_CORE_LOG_DEBUG("start to load all cache from file system"); + qCDebug(core, "start to load all cache from file system"); auto stored_data = GpgFrontend::DataObjectOperator::GetInstance().GetDataObject(drk_key_); @@ -259,9 +258,8 @@ auto CacheManager::LoadDurableCache(const QString& key) -> QJsonDocument { return p_->LoadDurableCache(key); } -auto CacheManager::LoadDurableCache(const QString& key, - QJsonDocument default_value) - -> QJsonDocument { +auto CacheManager::LoadDurableCache( + const QString& key, QJsonDocument default_value) -> QJsonDocument { return p_->LoadDurableCache(key, std::move(default_value)); } -- cgit v1.2.3