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

Method set

plugins/slice/ObjectSizeCache.cc:48–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void
49ObjectSizeCache::set(const std::string_view url, uint64_t object_size)
50{
51 std::lock_guard lock{_mutex};
52 cache_size_type i;
53 if (auto it = _index.find(url); it != _index.end()) {
54 // Already exists in cache. Overwrite.
55 i = it->second;
56 } else {
57 // Doesn't exist in cache. Evict something else.
58 find_eviction_slot();
59 i = _hand;
60 _urls[i] = url;
61 _index[_urls[i]] = _hand;
62 _hand++;
63 if (_hand >= _cache_capacity) {
64 _hand = 0;
65 }
66 }
67 _object_sizes[i] = object_size;
68}
69
70void
71ObjectSizeCache::remove(const std::string_view url)

Callers 2

sizeCacheAddMethod · 0.45
test_cache.ccFile · 0.45

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected