using Microsoft.Extensions.Caching.Memory; using Mirea.Api.Security.Common.Interfaces; using System; using System.Threading.Tasks; namespace Mirea.Api.Endpoint.Common.Services.Security; public class MemoryRevokedTokenService(IMemoryCache cache) : IRevokedToken { public Task AddTokenToRevokedAsync(string token, DateTimeOffset expiresIn) { cache.Set(token, true, expiresIn); return Task.CompletedTask; } public Task IsTokenRevokedAsync(string token) => Task.FromResult(cache.TryGetValue(token, out _)); }