Files
git.stella-ops.org/src/Scanner/__Libraries/StellaOps.Scanner.Cache/ScannerCacheOptions.cs
2025-10-28 15:10:40 +02:00

41 lines
1.3 KiB
C#

using System.IO;
namespace StellaOps.Scanner.Cache;
public sealed class ScannerCacheOptions
{
private const long DefaultMaxBytes = 5L * 1024 * 1024 * 1024; // 5 GiB
public bool Enabled { get; set; } = true;
public string RootPath { get; set; } = Path.Combine("cache", "scanner");
public string LayersDirectoryName { get; set; } = "layers";
public string FileCasDirectoryName { get; set; } = "cas";
public TimeSpan LayerTtl { get; set; } = TimeSpan.FromDays(45);
public TimeSpan FileTtl { get; set; } = TimeSpan.FromDays(30);
public long MaxBytes { get; set; } = DefaultMaxBytes;
public long WarmBytesThreshold { get; set; } = DefaultMaxBytes / 5; // 20 %
public long ColdBytesThreshold { get; set; } = (DefaultMaxBytes * 4) / 5; // 80 %
public bool EnableAutoEviction { get; set; } = true;
public TimeSpan MaintenanceInterval { get; set; } = TimeSpan.FromMinutes(15);
public bool EnableFileCas { get; set; } = true;
public string? ImportDirectory { get; set; }
public string? ExportDirectory { get; set; }
public string LayersDirectoryPath => Path.Combine(RootPath, LayersDirectoryName);
public string FileCasDirectoryPath => Path.Combine(RootPath, FileCasDirectoryName);
}