| 558 | } |
| 559 | |
| 560 | void LIRSCacheShard::TrimRecencyList(LIRSThreadState* tstate) { |
| 561 | // This function maintains the invariant that the oldest entry in the list must be |
| 562 | // a protected entry. Look at the oldest entry in the list (i.e. the front). If it is |
| 563 | // not protected, remove it from the list. If it is a tombstone entry, it needs to be |
| 564 | // deleted. Unprotected entries still exist in the unprotected list, so UNPROTECTED |
| 565 | // entries should only be removed from the recency list. |
| 566 | while (!recency_list_.empty() && recency_list_.front().state() != PROTECTED) { |
| 567 | LIRSHandle* oldest = &recency_list_.front(); |
| 568 | if (oldest->state() == TOMBSTONE) { |
| 569 | ToUninitialized(tstate, oldest, /* is_trim */ true); |
| 570 | } else { |
| 571 | DCHECK_EQ(oldest->state(), UNPROTECTED); |
| 572 | recency_list_.pop_front(); |
| 573 | } |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | void LIRSCacheShard::EnforceTombstoneLimit(LIRSThreadState* tstate) { |
| 578 | // If there are a large number of entries that haven't been seen before, the number |