File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -114,20 +114,23 @@ private void StoreInternal(TKey key, TEntry newEntry)
114114
115115 public bool TryLookup ( TKey key , [ NotNullWhen ( returnValue : true ) ] out TEntry ? entry )
116116 {
117- if ( _dict . TryGetValue ( key , out FixedCacheEntry < TKey , TEntry > ? wrappedEntry ) )
117+ lock ( _storeLock )
118118 {
119- entry = wrappedEntry . Entry ;
119+ if ( _dict . TryGetValue ( key , out FixedCacheEntry < TKey , TEntry > ? wrappedEntry ) )
120+ {
121+ entry = wrappedEntry . Entry ;
120122#if DEBUG
121- Metrics . Hit ( ) ;
123+ Metrics . Hit ( ) ;
122124#endif
123- return true ;
124- }
125+ return true ;
126+ }
125127#if DEBUG
126- Metrics . Miss ( ) ;
128+ Metrics . Miss ( ) ;
127129#endif
128130
129- entry = default ;
130- return false ;
131+ entry = default ;
132+ return false ;
133+ }
131134 }
132135
133136 public void Clear ( )
You can’t perform that action at this time.
0 commit comments