| 6 | #include "MaaUtils/Logger.h" |
| 7 | |
| 8 | MAA_NS_BEGIN |
| 9 | |
| 10 | std::optional<MaaNodeId> RuntimeCache::get_latest_node(const std::string& name) const |
| 11 | { |
| 12 | if (name.empty()) { |
| 13 | LogWarn << "name is empty"; |
| 14 | return std::nullopt; |
| 15 | } |
| 16 | |
| 17 | std::shared_lock lock(latest_nodes_mutex_); |
| 18 | |
| 19 | auto it = latest_nodes_.find(name); |
| 20 | if (it == latest_nodes_.end()) { |
| 21 | return std::nullopt; |
| 22 | } |
| 23 | return it->second; |
| 24 | } |
| 25 | |
| 26 | void RuntimeCache::set_latest_node(const std::string& name, MaaNodeId id) |
| 27 | { |