Partilhar via


MsalDistributedTokenCacheAdapterOptions Class

Definition

Options for the MSAL token cache serialization adapter, which delegates the serialization to the IDistributedCache implementations available with .NET Core.

public class MsalDistributedTokenCacheAdapterOptions : Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions
type MsalDistributedTokenCacheAdapterOptions = class
    inherit DistributedCacheEntryOptions
Public Class MsalDistributedTokenCacheAdapterOptions
Inherits DistributedCacheEntryOptions
Inheritance
MsalDistributedTokenCacheAdapterOptions

Constructors

MsalDistributedTokenCacheAdapterOptions()

Properties

DisableL1Cache

Disable the in-memory (L1) cache. Useful in scenarios where multiple apps share the same distributed (L2) cache.

EnableAsyncL2Write

Enable writing to the distributed (L2) cache to be async (i.e. fire-and-forget). This improves performance as the MSAL.NET will not have to wait for the write to complete.

Encrypt

Should the token cache be encrypted.

L1CacheOptions

Options of the in-memory (L1) cache.

OnL2CacheFailure

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 exception, 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 true if the cache should try the operation again, and false otherwise. When true is passed and the retry fails, an exception will be thrown.

Applies to