Azure.Storage.AutoRefreshingCache<TValue>
A thread-safe cache for a single expiring value that supports automatic proactive
background refresh. Only one acquisition runs at a time; concurrent callers wait
on the same TaskCompletionSource<T> rather than issuing duplicate
acquire calls.
Modeled after BearerTokenAuthenticationPolicy.AccessTokenCache in Azure.Core but fully generic.
public sealed delegate AcquireDelegate<TValue> : MulticastDelegate where TValue : struct, IExpiringValue, IEquatable<TValue>
Delegate the cache calls to acquire or refresh the value.
Returns the cached value, acquiring or refreshing it as necessary.
The first caller triggers acquisition; concurrent callers wait on the same result.
When the value approaches expiry, a background refresh is initiated so that no
caller blocks on a stale value.
Note: this method may throw exceptions from the acquire delegate. It also assumes that
the acquired value will be valid upon retrieval.
Clears the cached value only if the currently cached value equals
expectedValue.
The next call to GetAsync after a successful invalidation
will trigger a fresh acquisition.