Skip to content

Commit 5888655

Browse files
committed
Merge pull request #112 from andersea/master
Disable caching of Comments() action
2 parents 534bd61 + 462b3b4 commit 5888655

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

site/jekyll/getting-started/tutorial.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,16 @@ namespace ReactDemo.Controllers
402402
Let's also add a new controller action to return the list of comments:
403403

404404
```csharp
405+
[OutputCache(Location = OutputCacheLocation.None)]
405406
public ActionResult Comments()
406407
{
407408
return Json(_comments, JsonRequestBehavior.AllowGet);
408409
}
409410
```
410411

411-
And a corresponding route in `App_Start\RouteConfig.cs`:
412+
The OutputCache attribute is used here to prevent browsers from caching the response. When designing a real world API, caching of API requests should be considered more carefully. For this tutorial it is easiest to simply disable caching.
413+
414+
Finally we add a corresponding route in `App_Start\RouteConfig.cs`:
412415

413416
```csharp{12-16}
414417
using System.Web.Mvc;

0 commit comments

Comments
 (0)