| 129 | |
| 130 | template <typename HandleT> |
| 131 | Result<std::optional<HandleT>> findImpl(Key key) { |
| 132 | auto it = cachedItems_.find(key); |
| 133 | if (it != cachedItems_.end()) { |
| 134 | auto result = tryCreateHandle<HandleT>(*this, *it->second); |
| 135 | if (result.hasError()) { |
| 136 | return folly::makeUnexpected(std::move(result).error()); |
| 137 | } |
| 138 | return std::move(result).value(); |
| 139 | } |
| 140 | return std::nullopt; |
| 141 | } |
| 142 | |
| 143 | folly::coro::Task<Result<std::optional<ReadHandle>>> find(Key key) override { |
| 144 | co_return findImpl<ReadHandle>(key); |