v2.2.0
What's changed
- Provide a new overload for
ICache.GetOrAdd
enabling the value factory delegate to accept an input argument.
TValue GetOrAdd<TArg> (TKey key, Func<TKey,TArg,TValue> valueFactory, TArg factoryArgument)
If additional data is required to construct/fetch cached values, this provides a mechanism to pass data into the factory without allocating a new closure on the heap. Passing aCancellationToken
into to an async value factory delegate is a common use case. - Implement equivalent factory arg functionality for
IAsyncCache
,IScopedCache
andIAsyncScopedCache
. - To support different factory signatures without downstream code duplication, provide
IValueFactory
andIAsyncValueFactory
value types. - Implement build time package validation to prevent breaking changes going forward. Fixed all breaking changes introduced since v2.0.0. The v2.2.0 NET6 and NET3.1 build targets are fully compatible with v2.0.0 and v2.1.0 without recompilation. Intermediate point updates since v2.1.0 may require recompilation. The NET Standard 2.0 target is fully compatible with v2.0.0, but the updated event and metric are no longer included since they break compatibility.
Full changelog: v2.1.3...v2.2.0