diff --git a/Endpoint/Common/Services/Security/MemoryCacheService.cs b/Endpoint/Common/Services/Security/MemoryCacheService.cs index fcb1f09..6c5b8f6 100644 --- a/Endpoint/Common/Services/Security/MemoryCacheService.cs +++ b/Endpoint/Common/Services/Security/MemoryCacheService.cs @@ -23,8 +23,11 @@ public class MemoryCacheService(IMemoryCache cache) : ICacheService public Task GetAsync(string key, CancellationToken cancellationToken = default) { - cache.TryGetValue(key, out byte[]? value); - return Task.FromResult(JsonSerializer.Deserialize(value)); + return Task.FromResult( + cache.TryGetValue(key, out byte[]? value) ? + JsonSerializer.Deserialize(value) : + default + ); } public Task RemoveAsync(string key, CancellationToken cancellationToken = default)