MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / discard_cache

Method discard_cache

net/utils.cpp:326–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324 }
325
326 void discard_cache(std::string_view host, IPAddr ip) override {
327 auto ipaddr = dnscache_.borrow(host);
328 if (ip.undefined() || ipaddr->empty()) {
329 ipaddr.recycle(true);
330 } else {
331 IPAddrNode* node = nullptr;
332 DEFER(delete node);
333 SCOPED_LOCK(*ipaddr);
334 for (auto itr = ipaddr->rbegin(); itr != ipaddr->rend(); itr++) {
335 if ((*itr)->addr == ip) {
336 ipaddr->erase(node = *itr);
337 break;
338 }
339 }
340 ipaddr.recycle(ipaddr->empty());
341 }
342 }
343
344private:
345 ObjectCache<std::string, IPAddrList*> dnscache_;

Callers 2

dialMethod · 0.80
TESTFunction · 0.80

Calls 7

borrowMethod · 0.45
undefinedMethod · 0.45
emptyMethod · 0.45
recycleMethod · 0.45
rbeginMethod · 0.45
rendMethod · 0.45
eraseMethod · 0.45

Tested by 1

TESTFunction · 0.64