MCPcopy Create free account
hub / github.com/facebook/CacheLib / find

Method find

cachelib/object_cache/ObjectCache.h:929–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

927template <typename AllocatorT>
928template <typename T>
929std::shared_ptr<const T> ObjectCache<AllocatorT>::find(folly::StringPiece key) {
930 lookups_.inc();
931 auto found = this->l1Cache_->find(key);
932 if (!found) {
933 return nullptr;
934 }
935 succL1Lookups_.inc();
936
937 auto ptr = getAlignedItemPtr(found->getMemory())->objectPtr;
938 // Use custom deleter
939 auto deleter = Deleter<const T>(std::move(found));
940 return std::shared_ptr<const T>(reinterpret_cast<const T*>(ptr),
941 std::move(deleter));
942}
943
944template <typename AllocatorT>
945template <typename T>

Callers 2

verifyVisitsAllFoosMethod · 0.45
TESTFunction · 0.45

Calls 2

incMethod · 0.45
getMemoryMethod · 0.45

Tested by 2

verifyVisitsAllFoosMethod · 0.36
TESTFunction · 0.36