Caching table at startup ASP.NET MVC Application
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.
精彩评论