Class DefaultCache<T>
- Namespace
- Duende.IdentityServer.Services
- Assembly
- Duende.IdentityServer.dll
IMemoryCache-based implementation of the cache
public class DefaultCache<T> : ICache<T> where T : class
Type Parameters
T
- Inheritance
-
DefaultCache<T>
- Implements
-
ICache<T>
- Inherited Members
Constructors
DefaultCache(IdentityServerOptions, IMemoryCache, IConcurrencyLock<DefaultCache<T>>, ILogger<DefaultCache<T>>)
Initializes a new instance of the DefaultCache<T> class.
public DefaultCache(IdentityServerOptions identityServerOptions, IMemoryCache cache, IConcurrencyLock<DefaultCache<T>> concurrencyLock, ILogger<DefaultCache<T>> logger)
Parameters
identityServerOptions
IdentityServerOptionscache
IMemoryCacheThe cache.
concurrencyLock
IConcurrencyLock<DefaultCache<T>>logger
ILogger<DefaultCache<T>>The logger.
- See Also
-
ICache<T>
Properties
Cache
The memory cache.
protected IMemoryCache Cache { get; }
Property Value
- See Also
-
ICache<T>
ConcurrencyLock
A lock used for concurrency.
protected IConcurrencyLock<DefaultCache<T>> ConcurrencyLock { get; }
Property Value
- See Also
-
ICache<T>
IdentityServerOptions
The IdentityServerOptions.
public IdentityServerOptions IdentityServerOptions { get; }
Property Value
- See Also
-
ICache<T>
Logger
The logger.
protected ILogger<DefaultCache<T>> Logger { get; }
Property Value
- ILogger<DefaultCache<T>>
- See Also
-
ICache<T>
Methods
GetAsync(string)
public Task<T> GetAsync(string key)
Parameters
key
string
Returns
- Task<T>
- See Also
-
ICache<T>
GetKey(string)
Used to create the key for the cache based on the data type being cached.
protected string GetKey(string key)
Parameters
key
string
Returns
- See Also
-
ICache<T>
GetOrAddAsync(string, TimeSpan, Func<Task<T>>)
public Task<T> GetOrAddAsync(string key, TimeSpan duration, Func<Task<T>> get)
Parameters
Returns
- Task<T>
- See Also
-
ICache<T>
RemoveAsync(string)
public Task RemoveAsync(string key)
Parameters
key
string
Returns
- See Also
-
ICache<T>
SetAsync(string, T, TimeSpan)
public Task SetAsync(string key, T item, TimeSpan expiration)
Parameters
Returns
- See Also
-
ICache<T>
See Also
ICache<T>