Class ApplicationLocalDataCache
An ITokenCache for a local client application: the token is persisted in the ISecureCache and kept in memory for the next reads.
[Export(typeof(ITokenCache))]
[Shared]
public class ApplicationLocalDataCache : ITokenCache
- Inheritance
-
ApplicationLocalDataCache
- Implements
- Inherited Members
Constructors
ApplicationLocalDataCache(ISecureCache, ILogger)
Initializes a new instance of the ApplicationLocalDataCache class.
public ApplicationLocalDataCache(ISecureCache cache, ILogger logger)
Parameters
cacheISecureCacheThe secure cache in which the token is persisted.
loggerILoggerThe logger.
Methods
Clear(string)
Removes the token from the secure cache and from the in-memory copy. Errors are ignored.
public void Clear(string key)
Parameters
keystringThe key of the token.
DeleteItem(string)
Delete a token based on its unique key.
public void DeleteItem(string key)
Parameters
keystringThe unique key of the token.
Get<T>(string)
Gets a value.
public T? Get<T>(string key)
Parameters
keystringThe unique key.
Returns
- T
The value, or the default of
Twhen there is none.
Type Parameters
TThe type of the value.
Put<T>(string, T)
Adds or replaces a value.
public void Put<T>(string key, T data)
Parameters
keystringThe unique key.
dataTThe value to store. A null value is ignored by some implementations.
Type Parameters
TThe type of the value.