浏览代码

Changed cache expiry to be long

tags/3.0.0^2
Teknikode 3 年前
父节点
当前提交
39d875e4cf
共有 2 个文件被更改,包括 3 次插入4 次删除
  1. 2
    2
      Teknik/Controllers/DefaultController.cs
  2. 1
    2
      Teknik/Startup.cs

+ 2
- 2
Teknik/Controllers/DefaultController.cs 查看文件

@@ -56,7 +56,7 @@ namespace Teknik.Controllers
// Get the Favicon
[HttpGet]
[AllowAnonymous]
[ResponseCache(Duration = 60 * 60 * 24, Location = ResponseCacheLocation.Any)]
[ResponseCache(Duration = 31536000, Location = ResponseCacheLocation.Any)]
public IActionResult Favicon([FromServices] IHostingEnvironment env)
{
string imageFile = FileHelper.MapPath(env, Constants.FAVICON_PATH);
@@ -67,7 +67,7 @@ namespace Teknik.Controllers
// Get the Logo
[HttpGet]
[AllowAnonymous]
[ResponseCache(Duration = 60 * 60 * 24, Location = ResponseCacheLocation.Any)]
[ResponseCache(Duration = 31536000, Location = ResponseCacheLocation.Any)]
public IActionResult Logo([FromServices] IHostingEnvironment env)
{
string imageFile = FileHelper.MapPath(env, Constants.LOGO_PATH);

+ 1
- 2
Teknik/Startup.cs 查看文件

@@ -172,8 +172,7 @@ namespace Teknik
{
OnPrepareResponse = ctx =>
{
const int durationInSeconds = 60 * 60 * 24;
ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=" + durationInSeconds;
ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=" + 31536000;
}
});


正在加载...
取消
保存