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

Method remove

cachelib/navy/block_cache/BlockCache.cpp:608–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608Status BlockCache::remove(HashedKey hk) {
609 auto start = getSteadyClock();
610 SCOPE_EXIT {
611 removeLatency_.trackValue(toMicros(getSteadyClock() - start).count());
612 };
613 removeCount_.inc();
614
615 Buffer value;
616 if ((itemDestructorEnabled_ && destructorCb_) || preciseRemove_) {
617 uint32_t unused = 0;
618 Status status = lookup(hk, value, unused);
619
620 if (status != Status::Ok) {
621 // device error, or region reclaimed, or item not found
622 value.reset();
623 if (status == Status::Retry) {
624 return status;
625 } else if (status != Status::NotFound) {
626 lookupForItemDestructorErrorCount_.inc();
627 if (status == Status::ChecksumError) {
628 // checksum error doesn't need to be treated as a whole device's bad
629 // status
630 return status;
631 } else {
632 // still fail after retry, return a BadState to disable navy
633 return Status::BadState;
634 }
635 } else {
636 // NotFound
637 removeAttemptCollisions_.inc();
638 if (preciseRemove_) {
639 return status;
640 }
641 }
642 }
643 }
644
645 return removeImpl(hk, value.view());
646}
647
648/**
649 * Callback for region eviction.

Callers 5

removeImplMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 7

getSteadyClockFunction · 0.85
toMicrosFunction · 0.85
trackValueMethod · 0.80
countMethod · 0.80
incMethod · 0.45
resetMethod · 0.45
viewMethod · 0.45

Tested by 4

TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36