Microsoft.Identity.Client.CacheOptions
Options for MSAL token caches.
Options that disable MSAL's internal in-memory token cache entirely.
Use this when your application manages its own token cache lifecycle.
When set:
MSAL will not read from or write to the internal cache accessor.Token cache serialization callbacks (OnBeforeAccess, OnAfterAccess, OnBeforeWrite) will not be invoked. GetAccountsAsync will always return an empty collection. AcquireTokenSilent will throw a MsalUiRequiredException with error code InternalCacheDisabled. AcquireTokenInLongRunningProcess will throw a MsalUiRequiredException with error code InternalCacheDisabled, because the long-running OBO flow requires a cached token to refresh.For confidential client flows, retrieve the refresh token using GetRefreshToken and call AcquireTokenByRefreshToken to re-acquire a token on subsequent requests, or use another interactive flow.
Recommended options for using a static cache.
When set to true, MSAL will not read from or write to the internal in-memory token cache.
This is intended for advanced scenarios where the caller manages its own token cache.
Cannot be combined with UseSharedCache.
Share the cache between all ClientApplication objects. The cache becomes static. Defaults to false.
public CacheOptions()
Constructor for the options with default values.
Constructor