开发者

Caching table at startup ASP.NET MVC Application

开发者 https://www.devze.com 2023-01-23 15:00 出处:网络
I have ASP.NET MVC application, where I keep all of drop down values in a table. So on average every page accesses this table 2-3 times. I want to cache (load into memory) this table on application st

I have ASP.NET MVC application, where I keep all of drop down values in a table. So on average every page accesses this table 2-3 times. I want to cache (load into memory) this table on application startup.

Is there a way to do so? I have googled, but helpful topics found.

Thanks in a开发者_StackOverflowdvance.


You could use the built-in cache. As far as the application startup is concerned you could use the Application_Start method in global.asax.


Would loading it into a static variable do it for you?

You could populate it via the static constructor of whatever class your variable was contained in.

Sidenote: Have you tried just populating the drop down values dynamically on each page load? Was curious if this was a case of pre-optimizing that might not be necessary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号