mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user