| 137 | private: |
| 138 | template <bool AllowNullValues> |
| 139 | const TPtr GetValue(TArgs... args) const { |
| 140 | Key key = Callbacks.GetKey(args...); |
| 141 | switch (GettersPromotionPolicy) { |
| 142 | case EGettersPromotionPolicy::Promoted: |
| 143 | break; |
| 144 | case EGettersPromotionPolicy::Unpromoted: { |
| 145 | TReadGuard r(Mutex); |
| 146 | typename TInternalCache::TIterator i = Cache.FindWithoutPromote(key); |
| 147 | if (i != Cache.End()) { |
| 148 | return i.Value(); |
| 149 | } |
| 150 | break; |
| 151 | } |
| 152 | } |
| 153 | TWriteGuard w(Mutex); |
| 154 | typename TInternalCache::TIterator i = Cache.Find(key); |
| 155 | if (i != Cache.End()) { |
| 156 | return i.Value(); |
| 157 | } |
| 158 | TPtr value = Callbacks.CreateObject(args...); |
| 159 | if (value || AllowNullValues) { |
| 160 | Cache.Insert(key, value); |
| 161 | } |
| 162 | return value; |
| 163 | } |
| 164 | |
| 165 | private: |
| 166 | using TInternalCache = TCache<Key, TPtr, List<Key, TPtr>, TNoopDelete>; |
nothing calls this directly
no test coverage detected