You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Today, when the L2 cache fails, an error is logged, but given the L1 cache was able to proceed, we don't re-throw (think of Redis cache connection error)
Describe the solution you'd like
Have a new property in the MsalDistributedTokenCacheAdapterOptions, so that the application can handle the failure ?
/// <summary>/// Callback offered to the app to be notified when the L2 cache fails./// This way the app is given the possibility to act on the L2 cache,/// for instance, in the case of Redis, to reconnect. This is left to the application as it's/// the only one that knows about the real implementation of the L2 cache./// The handler should return <c>true</c> if the cache should try again the operation, and/// <c>false</c> otherwise. When <c>true</c> is passed and the retry fails, an exception/// will be thrown./// </summary>publicFunc<Exception,bool>?OnL2CacheFailure{get;set;}
Here is an example of how this would be hooked from the Startup.cs:
services.Configure<MsalDistributedTokenCacheAdapterOptions>(options =>{options.L1CacheSizeLimit=10*1024*1024;// 10 Mboptions.OnL2CacheFailure=(ex)=>{if(exisStackExchange.Redis.RedisConnectionException){// Attempt to act on the redis cache if at all possible?// Put here your reconnected codereturntrue;// Retry}returnfalse;// Don't retry.};});
Describe alternatives you've considered
We could also decide of the behavior when it fails again on retry (we could be silent instead of throwing)
The text was updated successfully, but these errors were encountered:
Look on stack overflow about the Redis connection issues; etc ..
@henrik-me will make sure we have the right people to help
jmprieur
changed the title
[Feature Request] Enable apps to decide what to do when the L2 cache fails
[Feature Request] Enable apps to decide what to do when the L2 cache fails (Retry)
Mar 5, 2021
Is your feature request related to a problem? Please describe.
Today, when the L2 cache fails, an error is logged, but given the L1 cache was able to proceed, we don't re-throw (think of Redis cache connection error)
Describe the solution you'd like
Have a new property in the
MsalDistributedTokenCacheAdapterOptions
, so that the application can handle the failure ?Here is an example of how this would be hooked from the Startup.cs:
Describe alternatives you've considered
We could also decide of the behavior when it fails again on retry (we could be silent instead of throwing)
The text was updated successfully, but these errors were encountered: