input/cache: use simpler intrusive::set API
This commit is contained in:
parent
65bbb975d2
commit
83acbe1002
10
src/input/cache/Manager.cxx
vendored
10
src/input/cache/Manager.cxx
vendored
@ -81,11 +81,9 @@ InputCacheManager::Get(const char *uri, bool create)
|
|||||||
if (!PathTraitsUTF8::IsAbsolute(uri))
|
if (!PathTraitsUTF8::IsAbsolute(uri))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
UriMap::insert_commit_data hint;
|
auto iter = items_by_uri.find(uri, items_by_uri.key_comp());
|
||||||
auto result = items_by_uri.insert_check(uri, items_by_uri.key_comp(),
|
if (iter != items_by_uri.end()) {
|
||||||
hint);
|
auto &item = *iter;
|
||||||
if (!result.second) {
|
|
||||||
auto &item = *result.first;
|
|
||||||
|
|
||||||
/* refresh */
|
/* refresh */
|
||||||
items_by_time.erase(items_by_time.iterator_to(item));
|
items_by_time.erase(items_by_time.iterator_to(item));
|
||||||
@ -112,7 +110,7 @@ InputCacheManager::Get(const char *uri, bool create)
|
|||||||
while (total_size > max_total_size && EvictOldestUnused()) {}
|
while (total_size > max_total_size && EvictOldestUnused()) {}
|
||||||
|
|
||||||
auto *item = new InputCacheItem(std::move(is));
|
auto *item = new InputCacheItem(std::move(is));
|
||||||
items_by_uri.insert_commit(*item, hint);
|
items_by_uri.insert(*item);
|
||||||
items_by_time.push_back(*item);
|
items_by_time.push_back(*item);
|
||||||
|
|
||||||
return InputCacheLease(*item);
|
return InputCacheLease(*item);
|
||||||
|
Loading…
Reference in New Issue
Block a user