#include "Cache.h" #include #include "mqtt++.h" #include std::optional Cache::cached_topic_value(const std::string& topic) { for (const auto& state : m_cache) { if (state.topic == topic) { return state.value; } } return std::nullopt; } TopicState Cache::set_topic_value(const std::string& topic, const std::string& value) { for (auto& state : m_cache) { if (state.topic == topic) { state.value = value; return state; } } return m_cache.emplace_back(topic, value); }