Files
adas-core/adas-core.Domain/Models/AppSettings/CacheSettings.cs
T
2026-06-26 10:29:23 +02:00

79 lines
2.5 KiB
C#

using adas_core.Domain.Enums;
namespace adas_core.Domain.Models.AppSettings;
/// <summary>
/// Represents configuration settings for a caching mechanism.
/// </summary>
public class CacheSettings
{
/// <summary>
/// Activa o desactiva por completo el sistema de caché.
/// Si es false, se usará NoCacheService para todas las entidades.
/// </summary>
public bool IsEnabled { get; set; } = true;
// Cada propiedad define cómo debe cachearse la entidad correspondiente:
// CacheMode None → no cachea nunca
// CacheMode Cache → in-memory (CacheService)
// CacheMode Redis → RedisService
public CacheEnum.Mode Patients { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode Displays { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode PumpObservations { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode Appointments { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode PointOfCares { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode GroupedObservations { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode PatientObservations { get; set; } = CacheEnum.Mode.Cache;
public CacheEnum.Mode ConfigObservations { get; set; } = CacheEnum.Mode.Cache;
// Configuración específica del backend InMemory
public InMemorySettings InMemory { get; set; } = new();
// Configuración específica del backend Redis
public RedisSettings Redis { get; set; } = new();
}
// -------------------- InMemory Cache --------------------
/// <summary>
/// Represents an in-memory implementation for managing application settings.
/// Provides storage and retrieval of configuration values without persisting them to an external source.
/// </summary>
public class InMemorySettings
{
public TtlSettings Ttl { get; set; } = new();
}
// -------------------- TTL por entidad --------------------
/// <summary>
/// Represents configuration settings related to Time-To-Live (TTL) behavior.
/// </summary>
public class TtlSettings
{
public int? GlobalSeconds { get; set; }
public int? PatientsSeconds { get; set; }
public int? DisplaysSeconds { get; set; }
public int? PumpObservationsSeconds { get; set; }
public int? AppointmentsSeconds { get; set; }
public int? ConfigObservationsSeconds { get; set; }
public int? PointOfCaresSeconds { get; set; }
public int? GroupedObservationsSeconds { get; set; }
public int? PatientObservationsSeconds { get; set; }
}