mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
22 lines
596 B
C#
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;
|
|
}
|
|
}
|
|
}
|