TokenCache TokenCache TokenCache TokenCache TokenCache Class


Token cache class used by AuthenticationContext to store access and refresh tokens.

public ref class TokenCache
class TokenCache
public class TokenCache
type TokenCache = class
Public Class TokenCache


TokenCache() TokenCache() TokenCache() TokenCache() TokenCache()

Default constructor.

TokenCache(Byte[]) TokenCache(Byte[]) TokenCache(Byte[]) TokenCache(Byte[]) TokenCache(Byte[])

Constructor receiving state of the cache


AfterAccess AfterAccess AfterAccess AfterAccess AfterAccess

Notification method called after any library method accesses the cache.

BeforeAccess BeforeAccess BeforeAccess BeforeAccess BeforeAccess

Notification method called before any library method accesses the cache.

BeforeWrite BeforeWrite BeforeWrite BeforeWrite BeforeWrite

Notification method called before any library method writes to the cache. This notification can be used to reload the cache state from a row in database and lock that row. That database row can then be unlocked in AfterAccess notification.

Count Count Count Count Count

Gets the nunmber of items in the cache.

DefaultShared DefaultShared DefaultShared DefaultShared DefaultShared

Static token cache shared by all instances of AuthenticationContext which do not explicitly pass a cache instance during construction.

HasStateChanged HasStateChanged HasStateChanged HasStateChanged HasStateChanged

Gets or sets the flag indicating whether cache state has changed. ADAL methods set this flag after any change. Caller application should reset the flag after serializing and persisting the state of the cache.


Clear() Clear() Clear() Clear() Clear()

Clears the cache by deleting all the items. Note that if the cache is the default shared cache, clearing it would impact all the instances of AuthenticationContext which share that cache.

DeleteItem(TokenCacheItem) DeleteItem(TokenCacheItem) DeleteItem(TokenCacheItem) DeleteItem(TokenCacheItem) DeleteItem(TokenCacheItem)

Deletes an item from the cache.

Deserialize(Byte[]) Deserialize(Byte[]) Deserialize(Byte[]) Deserialize(Byte[]) Deserialize(Byte[])

Deserializes state of the cache. The state should be the blob received earlier by calling the method Serialize.

ReadItems() ReadItems() ReadItems() ReadItems() ReadItems()

Reads a copy of the list of all items in the cache.

Serialize() Serialize() Serialize() Serialize() Serialize()

Serializes current state of the cache as a blob. Caller application can persist the blob and update the state of the cache later by passing that blob back in constructor or by calling method Deserialize.

Extension Methods

IsDefined(Object) IsDefined(Object) IsDefined(Object) IsDefined(Object) IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object) IsNull(Object) IsNull(Object) IsNull(Object) IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to