Add authentication methods to access protected resources #15

Merged
Wesser merged 13 commits from feat/auth into release/v1.0.0 2024-06-28 23:14:18 +03:00
Showing only changes of commit 612efcb91c - Show all commits

View File

@ -23,8 +23,11 @@ public class MemoryCacheService(IMemoryCache cache) : ICacheService
public Task<T?> GetAsync<T>(string key, CancellationToken cancellationToken = default) public Task<T?> GetAsync<T>(string key, CancellationToken cancellationToken = default)
{ {
cache.TryGetValue(key, out byte[]? value); return Task.FromResult(
return Task.FromResult(JsonSerializer.Deserialize<T>(value)); cache.TryGetValue(key, out byte[]? value) ?
JsonSerializer.Deserialize<T>(value) :
default
);
} }
public Task RemoveAsync(string key, CancellationToken cancellationToken = default) public Task RemoveAsync(string key, CancellationToken cancellationToken = default)