in cachelib/navy/block_cache/BlockCache.cpp [255:292]
Status BlockCache::remove(HashedKey hk) {
removeCount_.inc();
Buffer value;
if ((itemDestructorEnabled_ && destructorCb_) || preciseRemove_) {
Status status = lookup(hk, value);
if (status != Status::Ok) {
// device error, or region reclaimed, or item not found
value.reset();
if (status == Status::Retry) {
return status;
} else if (status != Status::NotFound) {
lookupForItemDestructorErrorCount_.inc();
// still fail after retry, return a BadState to disable navy
return Status::BadState;
} else {
// NotFound
removeAttemptCollisions_.inc();
if (preciseRemove_) {
return status;
}
}
}
}
auto lr = index_.remove(hk.keyHash());
if (lr.found()) {
holeSizeTotal_.add(decodeSizeHint(lr.sizeHint()));
holeCount_.inc();
succRemoveCount_.inc();
if (!value.isNull()) {
destructorCb_(hk.key(), value.view(), DestructorEvent::Removed);
}
return Status::Ok;
}
return Status::NotFound;
}