MCPcopy Create free account
hub / github.com/apache/trafficserver / find_eviction_slot

Method find_eviction_slot

plugins/slice/ObjectSizeCache.cc:86–104  ·  view source on GitHub ↗

* @brief Make _hand point to the next entry that should be replaced, and clear that entry if it exists. * */

Source from the content-addressed store, hash-verified

84 *
85 */
86void
87ObjectSizeCache::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
106ObjectSizeCache::cache_size_type
107ObjectSizeCache::cache_capacity()

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected