ITokenCache.SetAfterAccessAsync Method

Definition

Sets a delegate to be notified after any library method accesses the cache. This gives an option to the delegate to serialize a cache entry for the application and accounts specified in the TokenCacheNotificationArgs. See https://aka.ms/msal-net-token-cache-serialization. This provides the same functionality as SetAfterAccess but it provides for an async/task-based callback.

public void SetAfterAccessAsync (Func<Microsoft.Identity.Client.TokenCacheNotificationArgs,System.Threading.Tasks.Task> afterAccess);
abstract member SetAfterAccessAsync : Func<Microsoft.Identity.Client.TokenCacheNotificationArgs, System.Threading.Tasks.Task> -> unit
Public Sub SetAfterAccessAsync (afterAccess As Func(Of TokenCacheNotificationArgs, Task))

Parameters

afterAccess
Func<TokenCacheNotificationArgs,Task>

Delegate set in order to handle the cache serialization in the case where the HasStateChanged member of the cache is true

Remarks

In the case where the delegate is used to serialize the cache entirely (not just a row), it might want to call SerializeMsalV3()

Applies to