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 GetObjectAsync(string key, bool updateExpiration = true); Task SetObjectAsync(string key, T obj, bool updateExpiration = true); Task GetObjectAsync(string key, TimeSpan? ttlOverride, bool updateExpiration); Task SetObjectAsync(string key, T obj, TimeSpan? ttlOverride, bool updateExpiration); Task DeleteObjectAsync(string key); Task DeleteByPatternAsync(string pattern); void CleanCache(); // Métodos para transparencia y gestión de locks // GetOrSet (string key) Task GetOrSetValueAsync(string key, Func> loader, TimeSpan? ttlOverride = null); Task GetOrSetObjectAsync( string key, Func> factory, TimeSpan? ttl = null, CancellationToken cancellationToken = default); // GetOrSet especializado para GroupedObservations Task GetOrSetObjectAsync( GroupedField groupedField, ObjectId patientId, Func> factory, TimeSpan? ttl = null, CancellationToken cancellationToken = default); } }