Caching queries in Application scope
Posted on 2003-03-04
I am developing an ecommerce website. Obviously, many of the pages need to access product information. I don't want to hit the database (SQL Server 2k) everytime these pages are accessed. Therefore I've made the tentative decision to cache all the product information from the database into one or more Application scope variables. I will only refresh these App-scope variables when the product information is changed.
My question: is this a bad practice? How much information is too much to store in the Application scope. As far as I understand it, these apps are stored in RAM. My server has 512 MB RAM which will soon be upgraded to 1024 MB RAM. Since my entire SQL Server databse claims to be less than 20 MB, I could store the entire database inside RAM in the App-scope and not have to worry about it, right? Or is there overhead in doing this that I am missing?
If you recommend against doing what I plan to do, what would you do instead to avoid hitting the database?