MCPcopy Create free account
hub / github.com/facebook/CacheLib / lookup

Method lookup

cachelib/navy/block_cache/SparseMapIndex.cpp:114–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114Index::LookupResult SparseMapIndex::lookup(uint64_t key) {
115 auto& map = getMap(key);
116 auto lock = std::lock_guard{getMutex(key)};
117
118 auto it = map.find(subkey(key));
119 if (it != map.end()) {
120 LookupResult lr{true, it->second};
121
122 if (extraField_ == ExtraField::kTotalHits) {
123 it.value().extra.totalHits = safeInc(it.value().extra.totalHits);
124 }
125 it.value().currentHits = safeInc(it.value().currentHits);
126 return lr;
127 }
128 return {};
129}
130
131Index::LookupResult SparseMapIndex::peek(uint64_t key) const {
132 const auto& map = getMap(key);

Callers

nothing calls this directly

Calls 4

safeIncFunction · 0.85
findMethod · 0.45
endMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected