Skip to content

Commit 492cf8b

Browse files
With Ghost, Cheap Evict
1 parent c2265cd commit 492cf8b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cachelib/allocator/MMS3FIFO.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ void MMS3FIFO::Container<T, HookPtr>::maybeResizeGhostLocked() noexcept {
468468

469469
size_t expectedGhostSize =
470470
static_cast<size_t>(lruSize * config_.ghostSizePercent / 100);
471-
// ghostQueue_.resize(expectedGhostSize);
471+
ghostQueue_.resize(expectedGhostSize);
472472
capacity_ = lruSize;
473473
}
474474

@@ -539,8 +539,7 @@ bool MMS3FIFO::Container<T, HookPtr>::add(T& node) noexcept {
539539
const auto currTime = static_cast<Time>(util::getCurrentTimeSec());
540540

541541
const auto nodeHash = hashNode(node);
542-
// auto ghostContains = ghostQueue_.contains(nodeHash);
543-
auto ghostContains = false;
542+
auto ghostContains = ghostQueue_.contains(nodeHash);
544543
return lruMutex_->lock_combine([this, &node, currTime, ghostContains]() {
545544
if (node.isInMMContainer()) {
546545
return false;
@@ -680,7 +679,7 @@ bool MMS3FIFO::Container<T, HookPtr>::remove(T& node) noexcept {
680679
});
681680
if (result && isTiny_) {
682681
// // Insert to ghost queue
683-
// ghostQueue_.insert(hashNode(node));
682+
ghostQueue_.insert(hashNode(node));
684683
}
685684
return result;
686685
}
@@ -712,7 +711,7 @@ void MMS3FIFO::Container<T, HookPtr>::remove(LockedIterator& it) noexcept {
712711
if (it.l_.owns_lock()) {
713712
it.l_.unlock();
714713
}
715-
// ghostQueue_.insert(hashNode(node));
714+
ghostQueue_.insert(hashNode(node));
716715
}
717716
return;
718717
}

0 commit comments

Comments
 (0)