Reset cache
This commit is contained in:
@@ -29,4 +29,10 @@ public interface ICacheManager
|
||||
/// Gets an item from the cache, or creates it if it doesn't exist.
|
||||
/// </summary>
|
||||
Task<TItem?> GetOrCreateAsync<TItem>(object key, Func<ICacheEntry, Task<TItem>> factory);
|
||||
|
||||
/// <summary>
|
||||
/// remove an item from the cache
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
void Remove(string key);
|
||||
}
|
||||
@@ -22,10 +22,17 @@ public class CacheManager(IMemoryCache memoryCache, IChangeTokenSignaler changeT
|
||||
{
|
||||
return changeTokenSignaler.TriggerTokenAsync(key, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<TItem?> GetOrCreateAsync<TItem>(object key, Func<ICacheEntry, Task<TItem>> factory)
|
||||
{
|
||||
return await memoryCache.GetOrCreateAsync(key, async entry => await factory(entry));
|
||||
var result = await memoryCache.GetOrCreateAsync(key, async entry => await factory(entry));
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Remove(string key)
|
||||
{
|
||||
memoryCache.Remove(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user