| 30 | } |
| 31 | |
| 32 | std::optional<uint64_t> |
| 33 | ObjectSizeCache::get(const std::string_view url) |
| 34 | { |
| 35 | std::lock_guard lock{_mutex}; |
| 36 | if (auto it = _index.find(url); it != _index.end()) { |
| 37 | // Cache hit |
| 38 | cache_size_type i = it->second; |
| 39 | _visits[i] = true; |
| 40 | assert(url == _urls[i]); |
| 41 | return _object_sizes[i]; |
| 42 | } else { |
| 43 | // Cache miss |
| 44 | return std::nullopt; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | void |
| 49 | ObjectSizeCache::set(const std::string_view url, uint64_t object_size) |
no test coverage detected