MCPcopy Create free account
hub / github.com/apache/arrow / operator()

Method operator()

cpp/src/arrow/util/cache_internal.h:127–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 // the cache entry may be evicted by another thread.
126
127 Value operator()(const Key& key) {
128 std::unique_lock<std::mutex> lock(mutex_);
129 const Value* value_ptr;
130 value_ptr = cache_.Find(key);
131 if (ARROW_PREDICT_TRUE(value_ptr != nullptr)) {
132 return *value_ptr;
133 }
134 lock.unlock();
135 Value v = func_(key);
136 lock.lock();
137 return *cache_.Replace(key, std::move(v)).second;
138 }
139
140 private:
141 std::mutex mutex_;

Callers

nothing calls this directly

Calls 2

FindMethod · 0.45
ReplaceMethod · 0.45

Tested by

no test coverage detected