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

Method shouldReinsert

cachelib/navy/block_cache/HitsReinsertionPolicy.cpp:26–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 : hitsThreshold_{hitsThreshold}, index_(index) {}
25
26bool HitsReinsertionPolicy::shouldReinsert(folly::StringPiece key,
27 folly::StringPiece /* value */) {
28 const auto lr = index_.peek(
29 makeHK(
30 BufferView{key.size(), reinterpret_cast<const uint8_t*>(key.data())})
31 .keyHash());
32 if (!lr.found() || lr.currentHits() < hitsThreshold_) {
33 return false;
34 }
35
36 hitsOnReinsertionEstimator_.trackValue(lr.currentHits());
37 return true;
38}
39
40void HitsReinsertionPolicy::getCounters(
41 const util::CounterVisitor& visitor) const {

Callers 3

reinsertOrRemoveItemMethod · 0.45
TESTFunction · 0.45
TEST_FFunction · 0.45

Calls 8

makeHKFunction · 0.85
foundMethod · 0.80
currentHitsMethod · 0.80
trackValueMethod · 0.80
peekMethod · 0.45
keyHashMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by 2

TESTFunction · 0.36
TEST_FFunction · 0.36