Refactored cache ttl handling
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user