Files
Radicade/Server/CDN/CdnCaching.cs
T
2026-10-16 23:33:13 -07:00

22 lines
596 B
C#

using Microsoft.AspNetCore.Mvc;
namespace RadicadeServer.CDN
{
internal static class CdnCaching
{
public const string Immutable = "public, max-age=31536000, immutable";
public const string Replaceable = "public, max-age=86400";
public static string ForBlob(string name) =>
name.EndsWith(".assetbundle", StringComparison.OrdinalIgnoreCase) ? Immutable : Replaceable;
public static void Apply(Controller controller, string cacheControl)
{
if (controller.ControllerContext?.HttpContext == null) return;
controller.Response.Headers["Cache-Control"] = cacheControl;
}
}
}