Class TokenResponseCacheManager
Cache manager for the IdentityServer4 IdentityModel.Client.TokenResponse.
Inheritance
System.Object
TokenResponseCacheManager
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Geko.HttpClientService.Infrastructure
Assembly: Geko.HttpClientService.dll
Syntax
public class TokenResponseCacheManager : ITokenResponseCacheManager
Remarks
It caches a successful response for the 75% of the expiration time define in the IdentityModel.Client.TokenResponse.
Constructors
| Improve this Doc View SourceTokenResponseCacheManager(IMemoryCache)
Constructor of the TokenResponseCacheManager.
Declaration
public TokenResponseCacheManager(IMemoryCache memoryCache)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Caching.Memory.IMemoryCache | memoryCache | The in-memory cache. |
Methods
| Improve this Doc View SourceAddOrGetExistingAsync(String, Func<Task<TokenResponse>>)
Adds a new IdentityModel.Client.TokenResponse in the cache by executing the call
parameter, or returns an existing cached response.
Declaration
public async Task<TokenResponse> AddOrGetExistingAsync(string key, Func<Task<TokenResponse>> call)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the cache entry. |
Func<Task<IdentityModel.Client.TokenResponse>> | call | The delegate the returns a IdentityModel.Client.TokenResponse. |
Returns
Type | Description |
---|---|
Task<IdentityModel.Client.TokenResponse> | A IdentityModel.Client.TokenResponse, either just aqcuired or from the cache |
Remove(String)
Removes an entry from the cache
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the cache entry. |