Add authentication methods to access protected resources #15
@ -23,8 +23,11 @@ public class MemoryCacheService(IMemoryCache cache) : ICacheService
|
||||
|
||||
public Task<T?> GetAsync<T>(string key, CancellationToken cancellationToken = default)
|
||||
{
|
||||
cache.TryGetValue(key, out byte[]? value);
|
||||
return Task.FromResult(JsonSerializer.Deserialize<T>(value));
|
||||
return Task.FromResult(
|
||||
cache.TryGetValue(key, out byte[]? value) ?
|
||||
JsonSerializer.Deserialize<T>(value) :
|
||||
default
|
||||
);
|
||||
}
|
||||
|
||||
public Task RemoveAsync(string key, CancellationToken cancellationToken = default)
|
||||
|
Loading…
Reference in New Issue
Block a user