MCPcopy Create free account
hub / github.com/Tencent/phxqueue / GetAddrFromCache

Method GetAddrFromCache

phxqueue/comm/masterclient.cpp:37–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37bool MasterClientBase::GetAddrFromCache(const std::string &key, proto::Addr &addr) {
38 auto &&it(addr_cache_.find(key));
39 if (it != addr_cache_.end()) {
40 if (static_cast<uint64_t>(time(nullptr)) > it->second.second) return false;
41 addr = it->second.first;
42 return true;
43 }
44 return false;
45}
46
47void MasterClientBase::RemoveCache(const std::string &key) {
48 addr_cache_.erase(key);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected