diff --git a/services/distributeddataservice/service/udmf/store/store_cache.cpp b/services/distributeddataservice/service/udmf/store/store_cache.cpp index 9bd6ae679bae31ba76641bfffa2aaaf18f483726..2781004c38caafb67731536f61d2c681747546f9 100644 --- a/services/distributeddataservice/service/udmf/store/store_cache.cpp +++ b/services/distributeddataservice/service/udmf/store/store_cache.cpp @@ -60,7 +60,7 @@ std::shared_ptr StoreCache::GetStore(std::string intention) std::unique_lock lock(taskMutex_); if (taskId_ == ExecutorPool::INVALID_TASK_ID && executorPool_ != nullptr) { - taskId_ = executorPool_->Schedule(std::chrono::minutes(INTERVAL), std::bind(&StoreCache::GarbageCollect, this)); + taskId_ = executorPool_->Schedule(std::chrono::minutes(INTERVAL), [this]() { GarbageCollect(); }); } return store; } @@ -78,7 +78,7 @@ void StoreCache::GarbageCollect() std::unique_lock lock(taskMutex_); if (!stores_.Empty() && executorPool_ != nullptr) { ZLOGD("GarbageCollect, stores size:%{public}zu", stores_.Size()); - taskId_ = executorPool_->Schedule(std::chrono::minutes(INTERVAL), std::bind(&StoreCache::GarbageCollect, this)); + taskId_ = executorPool_->Schedule(std::chrono::minutes(INTERVAL), [this]() { GarbageCollect(); }); } else { taskId_ = ExecutorPool::INVALID_TASK_ID; }