Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop

This commit is contained in:
jrojas
2026-06-26 09:52:35 +02:00
commit 319fd3dfb0
746 changed files with 106610 additions and 0 deletions
@@ -0,0 +1,39 @@
using adas_core.Domain.Models.GroupedObservations;
using MongoDB.Bson;
namespace adas_core.Application.Services.Interfaces
{
public interface ICacheService
{
//Métodos básicos
void SetValue(string key, string value);
string? GetValue(string key);
Task<T?> GetObjectAsync<T>(string key, bool updateExpiration = true);
Task SetObjectAsync<T>(string key, T obj, bool updateExpiration = true);
Task<T?> GetObjectAsync<T>(string key, TimeSpan? ttlOverride, bool updateExpiration);
Task SetObjectAsync<T>(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration);
Task DeleteObjectAsync(string key);
Task<long> DeleteByPatternAsync(string pattern);
void CleanCache();
// Métodos para transparencia y gestión de locks
// GetOrSet (string key)
Task<string?> GetOrSetValueAsync(string key, Func<Task<string>> loader, TimeSpan? ttlOverride = null);
Task<T> GetOrSetObjectAsync<T>(
string key,
Func<Task<T>> factory,
TimeSpan? ttl = null,
CancellationToken cancellationToken = default);
// GetOrSet especializado para GroupedObservations
Task<T> GetOrSetObjectAsync<T>(
GroupedField groupedField,
ObjectId patientId,
Func<Task<T>> factory,
TimeSpan? ttl = null,
CancellationToken cancellationToken = default);
}
}