v2.3.0
What's changed
- Align
TryRemove
overloads withConcurrentDictionary
forICache
(includingWithAtomicGetOrAdd
). This adds two new overloads:bool TryRemove(K key, out V value)
- enables getting the value that was removed.bool TryRemove(KeyValuePair<K, V> item)
- enables removing an item only when the key and value are the same.
- Fix
ConcurrentLfu.Clear()
to remove all values when usingBackgroundThreadScheduler
. Previously values may be left behind after clear was called due to removed items present in window/protected/probation polluting the list of candidates to remove. - Fix
ConcurrentLru.Clear()
to reset the isWarm flag. Now cache warmup behaves the same for a new instance ofConcurrentLru
vs an existing instance that was full then cleared. PreviouslyConcurrentLru
could have reduced capacity during warmup after calling clear, depending on the access pattern. - Add extension methods to make it more convenient to use
AtomicFactory
with a plainConcurrentDictionary
. This is similar to storing aLazy<T>
instead ofT
, but with the same exception propagation semantics and API asConcurrentDictionary.GetOrAdd
.
Full changelog: v2.2.1...v2.3.0