Table of Contents

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
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 IdentityServerOptions
cache IMemoryCache

The cache.

concurrencyLock IConcurrencyLock<DefaultCache<T>>
logger ILogger<DefaultCache<T>>

The logger.

See Also

Properties

Cache

The memory cache.

protected IMemoryCache Cache { get; }

Property Value

IMemoryCache
See Also

ConcurrencyLock

A lock used for concurrency.

protected IConcurrencyLock<DefaultCache<T>> ConcurrencyLock { get; }

Property Value

IConcurrencyLock<DefaultCache<T>>
See Also

IdentityServerOptions

The IdentityServerOptions.

public IdentityServerOptions IdentityServerOptions { get; }

Property Value

IdentityServerOptions
See Also

Logger

The logger.

protected ILogger<DefaultCache<T>> Logger { get; }

Property Value

ILogger<DefaultCache<T>>
See Also

Methods

GetAsync(string)

public Task<T> GetAsync(string key)

Parameters

key string

Returns

Task<T>
See Also

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

string
See Also

GetOrAddAsync(string, TimeSpan, Func<Task<T>>)

public Task<T> GetOrAddAsync(string key, TimeSpan duration, Func<Task<T>> get)

Parameters

key string
duration TimeSpan
get Func<Task<T>>

Returns

Task<T>
See Also

RemoveAsync(string)

public Task RemoveAsync(string key)

Parameters

key string

Returns

Task
See Also

SetAsync(string, T, TimeSpan)

public Task SetAsync(string key, T item, TimeSpan expiration)

Parameters

key string
item T
expiration TimeSpan

Returns

Task
See Also

See Also

ICache<T>