Skip to content

Commit 99ec81e

Browse files
generatedunixname1395027625275998meta-codesync[bot]
authored andcommitted
fbcode/cachelib/allocator/nvmcache/TombStones.h (#441)
Summary: Pull Request resolved: #441 Reviewed By: MatzeB Differential Revision: D101369846 fbshipit-source-id: b2bd902a2216947fc90cca05dcd9878c54eef14d
1 parent fc764cc commit 99ec81e

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

cachelib/allocator/nvmcache/TombStones.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ class alignas(folly::hardware_destructive_interference_size) TombStones {
4242
// @return a valid Guard representing the tombstone
4343
Guard add(folly::StringPiece key) {
4444
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-
45+
auto [it, inserted] = keys_.try_emplace(key, 0);
5146
++it->second;
5247
return Guard(it->first, *this);
5348
}

0 commit comments

Comments
 (0)