MCPcopy Create free account
hub / github.com/catboost/catboost / GetOrNull

Method GetOrNull

library/cpp/cache/thread_safe_cache.h:53–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 const TPtr GetOrNull(TArgs... args) {
54 Key key = Callbacks.GetKey(args...);
55 switch (GettersPromotionPolicy) {
56 case EGettersPromotionPolicy::Promoted: {
57 TWriteGuard r(Mutex);
58 if (auto iter = Cache.Find(key); iter != Cache.End())
59 return iter.Value();
60 }
61 case EGettersPromotionPolicy::Unpromoted: {
62 TReadGuard r(Mutex);
63 if (auto iter = Cache.Find(key); iter != Cache.End())
64 return iter.Value();
65 }
66 }
67 return nullptr;
68 }
69
70 const TPtr Get(TArgs... args) const {
71 return GetValue<true>(args...);

Callers 1

Y_UNIT_TESTFunction · 0.80

Calls 4

GetKeyMethod · 0.45
FindMethod · 0.45
EndMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected