Skip to content

Commit fe47497

Browse files
authored
fix l2 cache refresh (#1062)
* fix l2 cache refresh * fix tests
1 parent 14b406f commit fe47497

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Microsoft.Identity.Web/TokenCacheProviders/Distributed/MsalDistributedTokenCacheAdapter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ protected override async Task<byte[]> ReadCacheBytesAsync(string cacheKey)
119119
_logger.LogDebug($"[MsIdWeb] MemoryCache: Count: {_memoryCache.Count}");
120120
}
121121
}
122+
else
123+
{
124+
await _distributedCache.RefreshAsync(cacheKey).ConfigureAwait(false);
125+
}
122126

123127
#pragma warning disable CS8603 // Possible null reference return.
124128
return result;

tests/Microsoft.Identity.Web.Test/TestDistributedCache.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ public Task<byte[]> GetAsync(string key, CancellationToken token = default)
2929

3030
public void Refresh(string key)
3131
{
32-
throw new System.NotImplementedException();
32+
// Don't process anything
3333
}
3434

3535
public Task RefreshAsync(string key, CancellationToken token = default)
3636
{
37-
throw new System.NotImplementedException();
37+
Refresh(key);
38+
return Task.CompletedTask;
3839
}
3940

4041
public void Remove(string key)

0 commit comments

Comments
 (0)