Set response cache to an hour

This commit is contained in:
2023-01-08 00:37:00 -08:00
parent 672e56d0aa
commit db29ac0891

View File

@@ -20,13 +20,22 @@ namespace AS1024.CommunityDocumentationPage.Controllers
_documentation = documentation; _documentation = documentation;
} }
[ResponseCache(Duration = 3600)]
public async Task<IActionResult> Index() public async Task<IActionResult> Index()
{ {
var results = await _documentation.GetBgpCommunities(); try
var filtered = results.Results.Where(b => b.Name.StartsWith(Configuration["ASN"])) {
.ToList(); var results = await _documentation.GetBgpCommunities();
var filtered = results.Results.Where(b => b.Name.StartsWith(Configuration["ASN"]))
.ToList();
return View(filtered); return View(filtered);
} catch (Exception ex)
{
_logger.LogError($"Failed to obtain data\n{ex}");
}
return View();
} }
[NonAction] [NonAction]