MCPcopy Create free account
hub / github.com/apache/arrow / Cache

Class Cache

cpp/src/gandiva/cache.h:44–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43template <class KeyType, typename ValueType>
44class Cache {
45 public:
46 explicit Cache(size_t capacity) : cache_(capacity) { LogCacheSize(capacity); }
47
48 Cache() : Cache(GetCacheCapacity()) {}
49
50 ValueType GetObjectCode(const KeyType& cache_key) {
51 std::optional<ValueType> result;
52 std::lock_guard<std::mutex> lock(mtx_);
53 result = cache_.get(cache_key);
54 return result != std::nullopt ? *result : nullptr;
55 }
56
57 void PutObjectCode(const KeyType& cache_key, const ValueType& module) {
58 std::lock_guard<std::mutex> lock(mtx_);
59 cache_.insert(cache_key, module);
60 }
61
62 private:
63 LruCache<KeyType, ValueType> cache_;
64 std::mutex mtx_;
65};
66} // namespace gandiva

Callers 1

CacheMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected