Skip to content

Commit

Permalink
Remove doNvmInvalidation flag in findToWrite() APIs
Browse files Browse the repository at this point in the history
Summary: Clean up this flag which was introduced when rolling out R/W handle.

Reviewed By: haowu14

Differential Revision: D52041835

fbshipit-source-id: 6cc195359ae8df3faf23638a25ba41c75ae3c31b
  • Loading branch information
Jiayue Bao authored and facebook-github-bot committed Dec 12, 2023
1 parent 95d21ad commit 248335b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
15 changes: 5 additions & 10 deletions cachelib/allocator/CacheAllocator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1790,15 +1790,13 @@ CacheAllocator<CacheTrait>::findFast(typename Item::Key key) {

template <typename CacheTrait>
typename CacheAllocator<CacheTrait>::WriteHandle
CacheAllocator<CacheTrait>::findFastToWrite(typename Item::Key key,
bool doNvmInvalidation) {
CacheAllocator<CacheTrait>::findFastToWrite(typename Item::Key key) {
auto handle = findFastImpl(key, AccessMode::kWrite);
if (handle == nullptr) {
return nullptr;
}
if (doNvmInvalidation) {
invalidateNvm(*handle);
}

invalidateNvm(*handle);
return handle;
}

Expand All @@ -1824,15 +1822,12 @@ CacheAllocator<CacheTrait>::findImpl(typename Item::Key key, AccessMode mode) {

template <typename CacheTrait>
typename CacheAllocator<CacheTrait>::WriteHandle
CacheAllocator<CacheTrait>::findToWrite(typename Item::Key key,
bool doNvmInvalidation) {
CacheAllocator<CacheTrait>::findToWrite(typename Item::Key key) {
auto handle = findImpl(key, AccessMode::kWrite);
if (handle == nullptr) {
return nullptr;
}
if (doNvmInvalidation) {
invalidateNvm(*handle);
}
invalidateNvm(*handle);
return handle;
}

Expand Down
9 changes: 2 additions & 7 deletions cachelib/allocator/CacheAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,10 @@ class CacheAllocator : public CacheBase {
// should call this API only when they are going to mutate the item data.
//
// @param key the key for lookup
// @param isNvmInvalidate whether to do nvm invalidation;
// defaults to be true
//
// @return the write handle for the item or a handle to nullptr if the
// key does not exist.
WriteHandle findToWrite(Key key, bool doNvmInvalidation = true);
WriteHandle findToWrite(Key key);

// look up an item by its key. This ignores the nvm cache and only does RAM
// lookup.
Expand All @@ -579,13 +577,10 @@ class CacheAllocator : public CacheBase {
// item data.
//
// @param key the key for lookup
// @param isNvmInvalidate whether to do nvm invalidation;
// defaults to be true
//
// @return the write handle for the item or a handle to nullptr if the
// key does not exist.
FOLLY_ALWAYS_INLINE WriteHandle
findFastToWrite(Key key, bool doNvmInvalidation = true);
FOLLY_ALWAYS_INLINE WriteHandle findFastToWrite(Key key);

// look up an item by its key. This ignores the nvm cache and only does RAM
// lookup. This API does not update the stats related to cache gets and misses
Expand Down

0 comments on commit 248335b

Please sign in to comment.