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

Method operator()

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

FindMethod · 0.45
ReplaceMethod · 0.45

Tested by

no test coverage detected