How to cache data in a MVC application

后端 未结 14 1144
鱼传尺愫
鱼传尺愫 2020-11-22 11:39

I have read lots of information about page caching and partial page caching in a MVC application. However, I would like to know how you would cache data.

In my scena

14条回答
  •  伪装坚强ぢ
    2020-11-22 12:30

    You can also try and use the caching built into ASP MVC:

    Add the following attribute to the controller method you'd like to cache:

    [OutputCache(Duration=10)]
    

    In this case the ActionResult of this will be cached for 10 seconds.

    More on this here

提交回复
热议问题