* @brief Make _hand point to the next entry that should be replaced, and clear that entry if it exists. * */
| 84 | * |
| 85 | */ |
| 86 | void |
| 87 | ObjectSizeCache::find_eviction_slot() |
| 88 | { |
| 89 | while (_visits[_hand]) { |
| 90 | _visits[_hand] = false; |
| 91 | _hand++; |
| 92 | if (_hand >= _cache_capacity) { |
| 93 | _hand = 0; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | std::string_view evicted_url = _urls[_hand]; |
| 98 | if (!evicted_url.empty()) { |
| 99 | auto it = _index.find(evicted_url); |
| 100 | assert(it != _index.end()); |
| 101 | _index.erase(it); |
| 102 | _urls[_hand].erase(); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | ObjectSizeCache::cache_size_type |
| 107 | ObjectSizeCache::cache_capacity() |