Caching
Caching is used to improve the performance in ASP.NET MVC. Caching is a technique which stores something in memory that is being used frequently to provide better performance. In ASP.NET MVC, OutputCache attribute is used for applying Caching. OutputCheching will store the output of a Controller in memory and if any other request comes for the same, it will return it from cache result.
OutputCache attribute can have a parameter.
Duration
It describes the time in seconds.The example of duration is given below.
- [OutputCache(Duration = 60)]
- public ActionResult Index() {
- var emps = from e in db.Employees
- orderby e.ID
- select e;
- return View(emps);
- }
VaryByPara