Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does System.Web.Caching.Cache make sense in an ASP.Net MVC app?

Since there is no concept of sessions in ASP.Net MVC and each request is independent of each other would I ever make use of the Cache object to internally cache data in order to minimize db access? The output caching functionality is great for caching view data but if I wanted to cache something like a user profile which should be shared amongst requests from the same user what would I do?

Thanks

like image 520
NabilS Avatar asked Nov 24 '25 06:11

NabilS


1 Answers

There is certainly the concept of a session in MVC... Session data is persisted across requests. I think you may be confusing that with ViewState, which is persisted across postbacks to the same page and isn't applicable in MVC.

like image 141
Rex M Avatar answered Nov 26 '25 23:11

Rex M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!