Caching data greatly increase the website performance as its not going to do server round trip. I have already mentioned how you can use Output caching in web forms in earlier blog post here. Let’s see how we can do same thing with asp.net mvc. For this example I have used asp.net mvc razor. In asp.net mvc you can use OutputCache attribute to cache the output. Just like below.[OutputCache(VaryByParam="none",Duration=60)]
public ActionResult Index()
{
ViewModel.Message = DateTime.Now.ToString();
...
↧