Refactored cache ttl handling

This commit is contained in:
2026-09-04 05:53:36 +02:00
parent 9728459223
commit 8ea014e4fb
6 changed files with 23 additions and 11 deletions
@@ -1,10 +1,10 @@
using Microsoft.Extensions.Caching.Distributed;
using PostFundManagement.Application.Abstractions;
using PostFundManagement.Application.Abstractions.Services;
using PostFundManagement.Domain.Errors;
namespace PostFundManagement.Application.Services.Shared;
public sealed class IdentityCacheService(IdentityService service, IDistributedCache cache) : IIdentityService
public sealed class IdentityCacheService(IdentityService service, IDistributedCache cache) : ServiceCacheBase, IIdentityService
{
public async ValueTask<Result> UserIsAuthorisedAsync(Guid userId, CancellationToken cancellationToken = default) =>
await Result.Try((Func<ValueTask<Result>>)(async () =>
@@ -19,7 +19,7 @@ public sealed class IdentityCacheService(IdentityService service, IDistributedCa
if (result.IsFailed) return result;
await cache.SetStringAsync(cacheKey, "true", cancellationToken);
await cache.SetStringAsync(cacheKey, "true", cacheOptions, cancellationToken);
return Result.Ok();
}