/// <summary> /// Async invalidate a cache value /// </summary> /// <param name="cacheKey">The cache key to invalidate</param> /// <param name="cancellationToken">The cancellation token</param> public async Task InvalidateValueAsync(string cacheKey, CancellationToken cancellationToken = default) { // Delete from local cache if present await _inMemoryCacheProvider.RemoveAsync(cacheKey, cancellationToken); // Delete from distributed cache if present await _distributedCacheProvider.RemoveAsync(cacheKey, cancellationToken); }
public async void RemoveAsync() { // Arrange string cacheKey = "Unit-Test-Cache"; _innerCacheMock.Setup(ic => ic.RemoveAsync(cacheKey, It.IsAny <CancellationToken>())); // Act await _cacheProvider.RemoveAsync(cacheKey); // Assert _innerCacheMock.Verify(ic => ic.RemoveAsync(cacheKey, It.IsAny <CancellationToken>())); }