cache home page and posts in cf for 15 minutes

This commit is contained in:
Tommy Parnell
2019-02-03 21:21:57 -05:00
parent d846a538a0
commit f3faede79e

View File

@@ -48,6 +48,7 @@ namespace TerribleDev.Blog.Web.Controllers
[Route("/index.html")]
[Route("/page/{pageNumber?}" )]
[OutputCache(Duration = 31536000, VaryByParam = "pageNumber")]
[ResponseCache(Duration = 900)]
public IActionResult Index(int pageNumber = 1)
{
if(!postsByPage.TryGetValue(pageNumber, out var result))
@@ -77,7 +78,7 @@ namespace TerribleDev.Blog.Web.Controllers
[Route("{postUrl}")]
[OutputCache(Duration = 31536000, VaryByParam = "postUrl")]
[ResponseCache(Duration = 180)]
[ResponseCache(Duration = 900)]
public IActionResult Post(string postUrl)
{
if(!posts.TryGetValue(postUrl, out var currentPost))