| 927 | template <typename AllocatorT> |
| 928 | template <typename T> |
| 929 | std::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 | |
| 944 | template <typename AllocatorT> |
| 945 | template <typename T> |