in src/AzureCacheOptionsProviderWithToken.cs [30:53]
internal AzureCacheOptionsProviderWithToken(
AzureCacheOptions azureCacheOptions)
: base()
{
_azureCacheOptions = azureCacheOptions;
IdentityClient = GetIdentityClient(azureCacheOptions);
_tokenRefreshTimer.Interval = azureCacheOptions.TokenHeartbeatInterval.TotalMilliseconds;
_tokenRefreshTimer.Elapsed += async (s, e) =>
{
try
{
await EnsureAuthenticationAsync(throwOnFailure: false).ConfigureAwait(false);
}
catch
{
// Throwing exceptions inside an async void Timer handler would crash the process, do don't allow them to propagate
// Any exceptions thrown during token retrieval will be reported to the client application via the TokenRefreshFailed or ConnectionReauthenticationFailed events
}
};
_tokenRefreshTimer.AutoReset = true;
_tokenRefreshTimer.Start();
}