We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc764cc commit 99ec81eCopy full SHA for 99ec81e
1 file changed
cachelib/allocator/nvmcache/TombStones.h
@@ -42,12 +42,7 @@ class alignas(folly::hardware_destructive_interference_size) TombStones {
42
// @return a valid Guard representing the tombstone
43
Guard add(folly::StringPiece key) {
44
std::lock_guard l(mutex_);
45
- auto it = keys_.find(key);
46
-
47
- if (it == keys_.end()) {
48
- it = keys_.insert(std::make_pair(key.toString(), 0)).first;
49
- }
50
+ auto [it, inserted] = keys_.try_emplace(key, 0);
51
++it->second;
52
return Guard(it->first, *this);
53
}
0 commit comments