43 std::string service_instance;
47 Entry(
const std::string& service,
const std::string host,
48 const std::string& _ip,
const std::string _port)
49 : service_instance(service), hostname(host), ip(_ip), port(_port) {}
52 static MdnsCache& GetInstance();
54 MdnsCache& operator=(MdnsCache&) =
delete;
55 MdnsCache(
const MdnsCache&) =
delete;
72 bool Add(
const std::string& service,
const std::string& host,
73 const std::string& _ip,
const std::string& _port);
80 bool Add(
const std::string& _ip,
const std::string& _port);
83 const std::vector<Entry>&
GetCache()
const {
return m_cache; }
86 mutable std::mutex m_mutex;
87 std::vector<Entry> m_cache;
Singleton cache for hosts looked up using mdns.
const std::vector< Entry > & GetCache() const
Return read-only cached entries reference.
bool Add(const Entry &entry)
Add new entry to the cache.
void Validate()
Check that all entries are accessible, remove stale ones.